Missing Aggregation

原文链接 : https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-missing-aggregation.html

译文链接 : Missing Aggregation

贡献者 : @于永超,ApacheCNApache中文网

Missing Aggregation

基于字段数据的单桶聚合,创建当前文档集上下文中缺少字段值的所有文档的bucket(桶)(有效地,丢失了一个字段或配置了NULL值集),此聚合器通常与其他字段数据桶聚合器(例如范围)结合使用,以返回由于缺少字段数据值而无法放置在任何其他存储区中的所有文档的信息。

例子:

  1. {
  2. "aggs" : {
  3. "products_without_a_price" : {
  4. "missing" : { "field" : "price" }
  5. }
  6. }
  7. }

在上面的例子中,我们得到了没有价格的产品总数。

  1. {
  2. ...
  3. "aggs" : {
  4. "products_without_a_price" : {
  5. "doc_count" : 10
  6. }
  7. }
  8. }