elasticsearch/docs/reference/aggregations/bucket/missing-aggregation.asciidoc
Przemko Robakowski 04f6b6fdb2
[DOCS] IDs for doc snippets (#49008)
* Ids for docs snippets

* Ids for tests

* Ids for docs snippets

* ignoring build folder from idea

* Ignoring build-eclipse
2019-11-25 15:30:00 +01:00

36 lines
No EOL
1.3 KiB
Text

[[search-aggregations-bucket-missing-aggregation]]
=== Missing Aggregation
A field data based single bucket aggregation, that creates a bucket of all documents in the current document set context that are missing a field value (effectively, missing a field or having the configured NULL value set). This aggregator will often be used in conjunction with other field data bucket aggregators (such as ranges) to return information for all the documents that could not be placed in any of the other buckets due to missing field data values.
Example:
[source,console,id=missing-aggregation-example]
--------------------------------------------------
POST /sales/_search?size=0
{
"aggs" : {
"products_without_a_price" : {
"missing" : { "field" : "price" }
}
}
}
--------------------------------------------------
// TEST[setup:sales]
In the above example, we get the total number of products that do not have a price.
Response:
[source,console-result]
--------------------------------------------------
{
...
"aggregations" : {
"products_without_a_price" : {
"doc_count" : 00
}
}
}
--------------------------------------------------
// TESTRESPONSE[s/\.\.\./"took": $body.took,"timed_out": false,"_shards": $body._shards,"hits": $body.hits,/]