WARNING: Version 1.3 of Elasticsearch has passed its EOL date.
This documentation is no longer being maintained and may be removed. If you are running this version, we strongly advise you to upgrade. For the latest information, see the current release documentation.
Bool Filter
editBool Filter
editA filter that matches documents matching boolean combinations of other queries. Similar in concept to Boolean query, except that the clauses are other filters. Can be placed within queries that accept a filter.
{ "filtered" : { "query" : { "queryString" : { "default_field" : "message", "query" : "elasticsearch" } }, "filter" : { "bool" : { "must" : { "term" : { "tag" : "wow" } }, "must_not" : { "range" : { "age" : { "from" : 10, "to" : 20 } } }, "should" : [ { "term" : { "tag" : "sometag" } }, { "term" : { "tag" : "sometagtag" } } ] } } } }
Caching
editThe result of the bool
filter is not cached by default (though
internal filters might be). The _cache
can be set to true
in order
to enable caching.