我想创建以下查询的等效项-
(city = 'New York' AND state = 'NY') AND ((businessName='Java' and businessName='Shop') OR (category='Java' and category = 'Shop'))
我使用必须和应该尝试了布尔查询的不同组合,但似乎没有任何效果。能做到吗?
这样的事情怎么样:
{ "query": { "match_all": {} }, "filter": { "bool": { "must": [ { "term": { "city": "New york" } }, { "term": { "state": "NY" } }, { "bool": { "should": [ { "bool": { "must": [ { "term": { "businessName": "Java" } }, { "term": { "businessName": "Shop" } } ] } }, { "bool": { "must": [ { "term": { "category": "Java" } }, { "term": { "category": "Shop" } } ] } } ] } } ] } } }