我读了下面关于Elasticsearch文档的文字。
https://www.elastic.co/guide/en/elasticsearch/reference/5.4/search-request-sort.html#_memory_considerations
When sorting, the relevant sorted field values are loaded into memory. This means that per shard, there should be enough memory to contain them.
这与我对排序的理解不同。我认为某些数据类型(例如关键字)应该已经排序,因为Elasticsearch会在它们上面创建索引。这些已经排序的字段不需要重新加载到内存中即可进行排序。
我知道吗?
最佳答案
关系数据库中的索引表示B *树,并且确实已排序。
Elasticsearch中的索引是您存储数据的地方;以前我们将它与关系世界中的表进行了比较,但是由于种种原因,这并不是真的。因此,我们不要将其用作直接比较。除了上面提到的索引时间排序Val,索引不存储为基于特定字段的排序数据结构。但是,某些字段可以有效地用于排序(例如数字数据类型或未分析的文本)。这就是上面的内存考虑因素起作用的地方。
关于elasticsearch - 排序时,Elasticsearch 5会做什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54626247/