This has been asked before (I googled!), but I thought I'd seen some
recent-or-maybe-not-that recent changes in ES about the special _version
field and being able to do 'something' extra with it other than it's use as
the Optimistic Locking pattern.
Certainly in ES 0.19 one can't query it, but is that still the case in more
recent ES versions at all? Just wanted to confirm if my memory of seeing
something in this area is incorrect.
My use case is External Versioning using timestamps as the version, so
being able to query items changed since a certain time would be useful. I
could index a separate "queryableVersion" field with the same value, but
maybe there's a better way.
The version field is not part of the underlying Lucene document and
therefore it is not indexable/queryable.
However, you are correct in that my answer is old and perhaps there have
been recent changes to provide that functionality. In the past, I looked
into the issue and the problem is that the version is updated into the
cluster state after the document has been committed. I am assuming the
functionality does not exist since there might be consistency issues if the
version value is updated before it is indexed. At least that is what I
remember.
This has been asked before (I googled!), but I thought I'd seen some
recent-or-maybe-not-that recent changes in ES about the special _version
field and being able to do 'something' extra with it other than it's use as
the Optimistic Locking pattern.
Certainly in ES 0.19 one can't query it, but is that still the case in
more recent ES versions at all? Just wanted to confirm if my memory of
seeing something in this area is incorrect.
My use case is External Versioning using timestamps as the version, so
being able to query items changed since a certain time would be useful. I
could index a separate "queryableVersion" field with the same value, but
maybe there's a better way.
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.