I would like to query by range for the "_id" property. I tried adding the "_id" on index time but as for v6.1.x is already added is not needed. I tried to query using a range but an exception is thrown with reason: "Field [_id] of type [_id] does not support range queries". Trying to update the mapping I get: "Field [_id] is defined twice in [doc]".
How can I modify the mapping or anything else to achieve this behaviour that seems was possible in <v6.0?
Yes, in 6.x you can NOT do range queries on _id field. But, you can do term or terms query on this field.
In 5.x, _id field was not indexed, its value was derived automatically from the _uid field.
In 6.x, _id field is indexed, and it is encoded in a special binary encoding, which makes range queries on this field not trivial.
Many thanks for answering @mayya. I ended using the official pagination (size, from) to get it working but hopefully at some point in future there is a workaround to this as if we want a cursor approach for pagination there is not an alternative right now to achieve it with ES.
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.