bucket_selector 中script执行结果

elasticsearch:

先随便贴一个查询数据:

GET /test/_search
{
  "size": 0,
  "aggs": {
    "find_missing_ids": {
      "histogram": {
        "field": "numeric_id",
        "interval": 1,
        "min_doc_count": 0
      },
      "aggs": {
        "max_bucket_selector": {
          "bucket_selector": {
            "buckets_path": {
              "count": "_count"
            },
            "script": {
              "inline": "count == 0"
            }
          }
        }
      }
    }
  }
}

需要注意的是,script字段中的表达式返回的结果只能是bool类型,int,float,double等其他类型会被转化成bool类型,所以通过
bucket_selector是不可能找到聚合后的最大值的
posted @ 2020-07-13 10:30  好想有一双翅膀啊  阅读(632)  评论(0)    收藏  举报