ELK - 9dian/Index GitHub Wiki

ES bool combination

ex1: (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" } } ] } } ] } } ] } } }

ex2: response = es.search(index="labeled_overview", body={"size": 10, "query": {"bool": {"should":[ {"bool": {"filter": [{"regexp": {"batch.name": ".wm."}},{"term": {"version": 1}}]}}, {"bool":{"filter":{"regexp" : { "tag_type" : ".foood." }}}}]}}, "_source": ["batch", "batch_id", "create_time", "tag_type"], "highlight": { "fields": {"batch.name":{"pre_tags" : [""],"post_tags" : [""], "type": "plain" }, "tag_type":{"pre_tags" : [""],"post_tags" : [""], "type": "plain"}}}}) <==> batch.name regexp ".wm." and version = 1 or tag_type regexp ".foood."

⚠️ **GitHub.com Fallback** ⚠️