WARNING: Version 1.5 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.
Not Filter
editNot Filter
editA filter that filters out matched documents using a query. Can be placed within queries that accept a filter.
{ "filtered" : { "query" : { "term" : { "name.first" : "shay" } }, "filter" : { "not" : { "range" : { "postDate" : { "from" : "2010-03-01", "to" : "2010-04-01" } } } } } }
Or, in a longer form with a filter
element:
{ "filtered" : { "query" : { "term" : { "name.first" : "shay" } }, "filter" : { "not" : { "filter" : { "range" : { "postDate" : { "from" : "2010-03-01", "to" : "2010-04-01" } } } } } } }
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). Here is
an example:
{ "filtered" : { "query" : { "term" : { "name.first" : "shay" } }, "filter" : { "not" : { "filter" : { "range" : { "postDate" : { "from" : "2010-03-01", "to" : "2010-04-01" } } }, "_cache" : true } } } }