Query filtered by _version range?


(Paul Smith) #1

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.

cheers,

Paul

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAHfYWB5iagSPcp4xem-zZo4DJkHG3V07vkS%2BwsxBTPq2kfTCNQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Ivan Brusic) #2

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.

Cheers,

Ivan

On Wed, Jan 22, 2014 at 4:44 PM, Paul Smith tallpsmith@gmail.com wrote:

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.

cheers,

Paul

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/CAHfYWB5iagSPcp4xem-zZo4DJkHG3V07vkS%2BwsxBTPq2kfTCNQ%40mail.gmail.com
.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQCeWadJo%2B%2BaYu%3DAvBN5bUfXUk_kcstaRp0JEYFj-Eu54g%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #3