Hi,
I am trying to create a query to request all the "cake" with blue or red or yellow color, and I guess
the condition similar to (blue OR red OR yellow) AND cake.
And I have look at the Elasticsearch Query String query documentation .
But the result that return from my query below is everything about cake with also all the other colors that I didn't specify. But the result I want is cake which is only blue, red and yellow.
Just wondering can anyone point me my error, since I have been googling for few hours, and trying different thing. Still couldn't make it work.
GET /events_2022/_search
{
"size":10,
"query": {
"bool": {
"should": [
{"match": {"color": "blue"}},
{"match": {"color": "red"}},
{"match": {"color": "yellow"}}
],
"must": [
{"match": {"item": "cake"}}
]
}
},
"aggs": {
"group_by_eventType": {
"terms": {
"field": "color.keyword",
"size" : 10000
}
}
}
,
"sort": { "eventTime": { "order": "desc" }}
}