Reputation: 11
I have following kind of data indexed into Elastic Search(ES). { "name":"XYZ", "categoryTags":["ABC","DEF","GHI", "IJK"....] }
I want to search all documents which have say categoryTags(atleast one of them or more) : "ABC" or "GHI" or "IJK" Can anyone suggest me a query for this use case?
Thanks in Advance
Upvotes: 0
Views: 418
Reputation: 2000
You can make use of Term Filter or the Term Query. You can pass the query body as post parameter. Details can be easily found in ES docs.
{
"filter" : {
"terms" : {
"categoryTags" : ["ABC", "GHI", ...]
}
}
}
or
{
"query" : {
"term" : {"categoryTags" : ["ABC", "GHI", ...]}
}
}
Refer to ES documents.
Upvotes: 1
Reputation: 292
Copy and paste below command at your webbrowser.
http://xx.xx.xx.xx:9200/index_v1/type/_search?q=categorytag:abc|ghi&size=50
i hope this is very useful to u .
Upvotes: 0