BoolQuery and should


#1

Hello,
I am looking to integrate two should in a query. For example, I have this query and I would like to have another should filter:
"should": [
{ "match": { "message": "OK" }},
{ "match": { "message": "FINE" }}
],
"minimum_should_match" : 1

CODE that I have implemented:

GET /my_index/my_type/_search
{
"query": {
"bool": {
"must": { "match": { "how": "quick" }},
"should": [
{ "match": { "title": "brown" }},
{ "match": { "title": "dog" }}
],
"minimum_should_match" : 1
}
}
}

Both "should" have two match at least one, It is something similar to OR in relational databases: SELECT .... where (message ='OK' or message='FINE') and (title = "brown" or title = "brown") and how = "quick"

How can I do that? thanks


(system) #2

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.