0

How to make sorting like this:

->orderByRaw('payed_promo >= ' . $time . ' DESC') 
->orderByRaw('payed_vip >= ' . $time . ' DESC') 
->orderBy('rating->urls->' . $url_1 . '->rating', 'DESC')

Here is my sorting from MySQL(Eloquent laravel) how to do this on Elasticsearch?

1 Answer 1

1

You can specify the "sort" parameter.

From official documentation, "show all matching results sorted first by date, then by relevance":

   "sort": [
        { "date":   { "order": "desc" }},
        { "_score": { "order": "desc" }}
    ]

https://www.elastic.co/guide/en/elasticsearch/guide/current/_sorting.html

There is also "boost" parameter, that affects the default results order: https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-boost.html

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.