“terms” filter is just like
“term” filter, but is used to search for multiple values.
1.Get all the documents where employee id's are
358, 75 and 12
One way to solve this by using bool and term filters.
One way to solve this by using bool and term filters.
GET /organization/employee/_search { "query": { "filtered": { "filter": { "bool" :{ "should": [ {"term" : {"id" : "358"}}, {"term" : {"id" : "75"}}, {"term" : {"id" : "12"}} ] } } } } }
We can
rewrite above query using terms filter.
GET /organization/employee/_search { "query": { "filtered": { "filter": { "terms" : {"id" : [358, 75, 12]} } } } }
No comments:
Post a Comment