根据某一fieldA进行分组,然后按每组中另一fieldB的总和

2021-12-30  本文已影响0人  butters001
{
    "track_total_hits": "true",
    "query": {
        "bool": {
            "must": []
        }
    },
    "size": 0,
    "aggs": {
        "nums": {
            "aggs": {
                "count": {
                    "sum": {
                        "field": "B.trigger_nums"
                    }
                }
            },
            "terms": {
                "field": "A.keyword",
                "size": 5,
                "order": {
                    "count": "desc"
                }
            }
        }
    }
}
上一篇下一篇

猜你喜欢

热点阅读