Reputation: 377
Is it possible to search documents in Elastic Search index by version? I try this:
curl -XGET eshost:9200/myindex/mytype/_search -d '{query:{match:{_version:"2"}}}'
But it does not work.
I need such a query to get all documents, that have never been updated.
Upvotes: 18
Views: 17287
Reputation: 1
Filter by version is not possible, you can just get the version of each document by set the parameter "version" = true
Upvotes: 0
Reputation: 21
You might try
GET index/item/_search?pretty=version
{
"version": true
}
Upvotes: 1
Reputation: 2198
you can search like normal and set version as true and it will return you count of all the versions for each document:
GET indextest/original/_search?pretty=true
{
"version": true
}
Upvotes: 5
Reputation: 27487
Unfortunately, you cannot query or filter by _version - the problem is that that field is not indexed, so queries and filters cannot access it:
http://elasticsearch-users.115913.n3.nabble.com/Can-i-filter-query-by-version-td4044331.html
Upvotes: 14
Reputation: 1015
Try using version
Returns a version for each search hit.
{
"version": true,
"query" : {
"term" : { "user" : "kimchy" }
}
}
Upvotes: 20