es聚合having count>0

GET /gunspoc/_search
{
  "query": {
    "match": {
      "name": "姓名"
    }
  },
  "aggs": {
    "fenzu": {
      "terms": {
        "field": "age"
      },
     "aggs": {
      "having":{
      "bucket_selector": {
        "buckets_path": {
          "aggrs": "_count"
        },
        "script": {
          "source": "params.aggrs > 0"
        }
      }
    }
     }
    }
  }
}

 

posted @ 2021-11-09 17:31  动力起点  阅读(519)  评论(0编辑  收藏  举报