聚合
提示
聚合查询,更多信息查看官网官方文档 (opens new window)
# 构造数据
# avg
GET /accounts-2023-06-30/_search
{
"aggs": {
"avg_age": {
"avg": {
"field": "age"
}
}
},
"size": 0
}
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
# max
GET /accounts-2023-06-30/_search
{
"aggs": {
"max_age": {
"max": {
"field": "age"
}
}
},
"size": 0
}
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
# min
GET /accounts-2023-06-30/_search
{
"aggs": {
"min_age": {
"min": {
"field": "age"
}
}
},
"size": 0
}
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
# sum
GET /accounts-2023-06-30/_search
{
"aggs": {
"sum_age": {
"sum": {
"field": "age"
}
}
},
"size": 0
}
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
上次更新: 2023/08/08, 20:00:46