When searching for results, the standard criterion for sorting in Elasticsearch is the relevance to a text query. Real-world applications often need to control the sorting criteria in scenarios, such as the following:
- Sorting a user by last name and first name
- Sorting items by stock symbols, price (ascending and descending)
- Sorting documents by size, file type, source, and so on
- Sorting item related maximum or minimum or average of some children fields