Elasticsearch search for elements with the specified example ID

I want to find certain elements in my elastic search that have a given identifier, and I cannot figure out how to do this.

I see http://www.elasticsearch.org/guide/reference/query-dsl/ids-query/ , but cannot for the life of me figure out how to structure a query to use it, or when I make a toy using 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 someone tell me how to do this? Thanks.

edit: My attempt with this error was related to es-head, but with similar errors via curl. I believe I tried the option:

 { "query": { "match_all": {} }, "ids": { "values": [ "100" ] } } 
+7
source share
1 answer

ids is a request type, like match , or match_all . Therefore, the format should be:

 {"query":{ "ids":{ "values": [ 100 ] } } } 

You can alternatively do this as a filter, for example:

 {"filter":{ "query": {"ids":{ "values": [ 100 ] } } } } 
+17
source

All Articles