Elasticsearch 查询结果排序，部分内容来自 B 站中华石杉 Elasticsearch 顶尖高手系列课程核心知识篇，英文内容来自官方文档。
Sort search results
Allows you to add one or more sorts on specific fields. Each sort can be reversed as well. The sort is defined on a per field level, with special field name for _score to sort by score, and _doc to sort by index order.
The sort values for each document returned are also returned as part of the response.
Sort mode example usage
When sorting, the relevant sorted field values are loaded into memory. This means that per shard, there should be enough memory to contain them. For string based types, the field sorted on should not be analyzed / tokenized. For numeric types, if possible, it is recommended to explicitly set the type to narrower types(like short, integer and float).
版权声明: 本文为 InfoQ 作者【escray】的原创文章。