Sorting results
Sometimes, you may want to provide the user with a result set that is sorted based on a custom logic rather than the default scoring employed by Elasticsearch. Say you want to display some items that match your search query sorted according to the prize in the ascending or descending order. Elasticearch helps you do that quite easily. Let's see how various sort methods are used in Elasticsearch.
One thing that we should keep in mind while sorting is that the particular field based on which you sort, should be loaded in the memory. It's well and good if you have enough resources to sort. Sort is basically done on the field level. Elasticsearch provides support to perform sorting on arrays or multivalued fields.
However, if the sort ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access