I want to find certain elements in my elastic search that have a given ID and I can't figure an easy way to do this.
I see http://www.elasticsearch.org/guide/reference/query-dsl/ids-query/ but can't for the life of me figure out how to structure a query to use it, or when I do toy around with es-head or curl I see errors like:
Parse Failure [Failed to parse source [{"query":{"match_all":{}},"ids
{"values""1","4","100"]}}]]]; nested: SearchParseException[[dailyaggregates][4]:
query[ConstantScore(NotDeleted(*:*))],from[-1],size[-1]: Parse Failure [No parser for
element [ids]]]; }]
etc. Can anyone tell me how to set this up? Thanks.
edit: My attempt with that error was from es-head but similar errors through curl. I believe what I tried was some variant of this:
{
"query": {
"match_all": {}
},
"ids": {
"values": [
"100"
]
}
}
ids
is a type of query, just like match
, or match_all
. So the format should be:
{"query":{ "ids":{ "values": [ 100 ] } } }
You can alternatively do it as a filter, like so:
{"filter":{ "query": {"ids":{ "values": [ 100 ] } } } }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With