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.
Or Filter
editOr Filter
editA filter that matches documents using the OR
boolean operator on other
filters. Can be placed within queries that accept a filter.
{ "filtered" : { "query" : { "term" : { "name.first" : "shay" } }, "filter" : { "or" : [ { "term" : { "name.second" : "banon" } }, { "term" : { "name.nick" : "kimchy" } } ] } } }
Caching
editThe result of the filter is not cached by default. The _cache
can be
set to true
in order to cache it (though usually not needed). Since
the _cache
element requires to be set on the or
filter itself, the
structure then changes a bit to have the filters provided within a
filters
element:
{ "filtered" : { "query" : { "term" : { "name.first" : "shay" } }, "filter" : { "or" : { "filters" : [ { "term" : { "name.second" : "banon" } }, { "term" : { "name.nick" : "kimchy" } } ], "_cache" : true } } } }