| 12345678910111213141516171819202122232425262728293031323334 | [[java-aggs-bucket-missing]]==== Missing AggregationHere is how you can use{ref}/search-aggregations-bucket-missing-aggregation.html[Missing Aggregation]with Java API.===== Prepare aggregation requestHere is an example on how to create the aggregation request:[source,java]--------------------------------------------------AggregationBuilders.missing("agg").field("gender");--------------------------------------------------===== Use aggregation responseImport Aggregation definition classes:[source,java]--------------------------------------------------import org.elasticsearch.search.aggregations.bucket.missing.Missing;--------------------------------------------------[source,java]--------------------------------------------------// sr is here your SearchResponse objectMissing agg = sr.getAggregations().get("agg");agg.getDocCount(); // Doc count--------------------------------------------------
 |