{ "query": { "term": { "time_d": "20230508" } }, "aggs": { "articles_over_time": { "date_histogram": { "field": "call_time", "interval": "hour" }, "aggs": { "sum_total_number": { "sum": { "field": "total_number" } } } } } }
1、time_d 匹配值为 20230508 的记录
2、以 call_time(时间类型) 字段每小时分一个段
3、对 total_number 字段求和
参考链接:
https://www.jianshu.com/p/3d9c4ff22dc2
https://www.jianshu.com/p/1ab2c741af03
标签:www,求和,sum,number,时间段,time,Elasticsearch,total From: https://www.cnblogs.com/nihaorz/p/17389388.html