WARNING: Version 1.7 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.
Search requests
editSearch requests
editWhile the search
API takes a top-level query
parameter, the
count
, delete-by-query
and
validate-query
requests expected the whole body to be a
query. These now require a top-level query
parameter:
GET /_count { "query": { "match": { "title": "Interesting stuff" } } }
Also, the top-level filter
parameter in search has been renamed to
post_filter
, to indicate that it should not
be used as the primary way to filter search results (use a
filtered
query instead), but only to filter
results AFTER facets/aggregations have been calculated.
This example counts the top colors in all matching docs, but only returns docs
with color red
:
GET /_search { "query": { "match_all": {} }, "aggs": { "colors": { "terms": { "field": "color" } } }, "post_filter": { "term": { "color": "red" } } }