Reputation: 162
I store some documents in index "blog".
When I open URL http://localhost:9200/blog/post/90?pretty=true by browser I have the different value in "_version" field. ElasticSearch store 2 version of my document and return it randomly.
How to get the last document?
Upvotes: 0
Views: 2097
Reputation: 4733
The _version property is used to implement optimistic locking. There cannot be two documents with a different version in the index. At least not in the same shard. Their might be a very short time frame in which the replicate shard can have an older version. Each update to the documents increases the version number. You can find more information about this in this blog post:
http://www.elasticsearch.org/blog/versioning/
Upvotes: 5