如果一个query查询出若干条数据, 但是我只想从第n条到第m条数据求和, 能用聚合分析吗?我该怎么操作?求大神指点
Elasticsearch | 作者 felixzxk | 发布于2020年08月07日 | 阅读数:1776
问题如标题
示例数据如下:
大神来指点下
示例数据如下:
{
"_index" : "test-point",
"_type" : "_doc",
"_id" : "1",
"_score" : 1.0,
"_source" : {
"value" : 128,
"time" : "2019-01-01"
}
},
{
"_index" : "test-point",
"_type" : "_doc",
"_id" : "2",
"_score" : 1.0,
"_source" : {
"value" : 128,
"time" : "2019-01-02"
}
},
{
"_index" : "test-point",
"_type" : "_doc",
"_id" : "3",
"_score" : 1.0,
"_source" : {
"value" : 57,
"time" : "2019-01-03"
}
},
{
"_index" : "test-point",
"_type" : "_doc",
"_id" : "4",
"_score" : 1.0,
"_source" : {
"value" : 23,
"time" : "2019-01-03"
}
},
{
"_index" : "test-point",
"_type" : "_doc",
"_id" : "5",
"_score" : 1.0,
"_source" : {
"value" : 18,
"time" : "2019-01-04"
}
},
{
"_index" : "test-point",
"_type" : "_doc",
"_id" : "6",
"_score" : 1.0,
"_source" : {
"value" : 195,
"time" : "2019-01-05"
}
}
数据量如果很大, 比如query查出100万条数据, 我想统计第50万条到第100万条数据中value的和, 该怎么搞?大神来指点下
1 个回复
pony_maggie - 公众号:犀牛饲养员的技术笔记
赞同来自: felixzxk