The documentation suggests using low cardinality field(s) for index sorting.
We often search documents with some low cardinality ID (like site or org) and then with timestamp.
Does it make sense to include timestamp in the mix?
I am paying a little bit overhead for the write with "index sorting". If I can't get much out of it, I will remove timestamp to gain back the write performance.
Index sorting on a field is good for 2 things: to reduce disk usage and speed up queries with sort on this field. Disk space is reduced because we can efficiently compress the same values, but this would not help timestamp field, as I expect this field will have all unique values. So there are no benefits here for timestamp field.
You can speed up sort queries but only in one direction, if your index is sorted by timestamp desc, only these queries with sort timestamp desc will be faster, queries on timestamp asc will not be.
Moreover, in the newer version of Elasticsearch, we have implemented automatic sort optimizations on timestamp field both asc and desc, so you don't need index sorting there as well, sort queries on timestamp should be quite fast.
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.