在es中需要根据app_categor进行聚合,JSON查询语句如下:

{
  "query": {
    "bool": {
      "must": [
        {
          "term": {
            "flag_color": "3"
          }
        },
        {
          "term": {
            "atype": "0"
          }
        },
        {
          "term": {
            "flag_off": "0"
          }
        }
      ]
    }
  },
  "explain": true,
  "aggs": {
    "appCategory": {
      "terms": {           //聚合字段为字母
        "field": "app_category",  //聚合字段
        "order": [          //按聚合字段字母进行排序
          {
            "_term": "asc"     
          }
        ],
        "size": 50                 //聚合显示结果数量(默认10条)
      }
    }
  }
}

 

相关文章:

  • 2021-06-09
  • 2022-12-23
  • 2022-12-23
  • 2021-07-05
  • 2022-12-23
  • 2022-12-23
  • 2021-06-21
猜你喜欢
  • 2021-12-07
  • 2022-12-23
  • 2022-12-23
  • 2021-11-22
  • 2022-02-25
  • 2021-11-10
  • 2022-01-12
相关资源
相似解决方案