ElasticSearch中用aggs聚合求每分钟数据求和,并用java获取到数据.
最近要做一个图表,数据为每分钟委托笔数, 数据在ElasticSearch中存储, 并且每分钟可能有多条数据, 这里就用到了ElasticSearch聚合. 具体的ElasticSearch head插件中语句如下:
{
"query": {
"filtered": {
"filter": {
"bool": {
"must": [ { "range": { "time": { "gte": "2016.09.07 09:15:50", "lte": "2016.09.07 15:00:00" } } } ] }
}
}
},
"aggs": {
"articles_over_time": {
"date_histogram": {
"field": "time",
"interval":