What's the difference between sorting according to a specific field (adding a sort clause in the query itself) and adding sorting in the index definition (meaning, sorting it on the segment level), without adding sort clause to the query?
For example, what will be the performance difference between searching on index that was created with the following settings (like here):
While this means an additional step needs to be taken during indexing and thus throughput will be reduced, it also means that when searching for data and the query sorting is the same than the index sorting, that searches will be much faster, as searching pre sorted data means possibility of early termination during a search.
I think what @liorisme6 was asking, is about the difference between defining index sorting and not at all. i.e, can you explain how elastic will sort, lets say, numeric field when using:
"sort": [
{
"my_date_field": "desc"
}]
and without defining index sorting.
I would expect ES to use the (sorted) inverted index (when the query is using the same field "my_date_field" of course). Isn't that the case?
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.