I am trying to work if there is a difference between “filters” and “filtered queries” in Elasticsearch.
The two query examples below return the same results when they run against my index.
Are they really different from each other in any subtle way?
Is there a reason someone prefers each other in different situations?
DSL gives one top level query , and one top level filter :
GET /index/type/_search?_source { "query": { "multi_match": { "query": "my dog has fleas", "fields": ["name", "keywords"] } }, "filter": { "term": {"status": 2} } }
DSL only gives the top level query using the filtered construct:
GET /index/type/_search?_source { "query": { "filtered": { "query": { "multi_match": { "query": "my dog has fleas", "fields": ["name", "keywords"] } }, "filter": { "term": {"status": 2} } } } }
billc source share