是否可以生成小计?我有这样的聚集:
body_options: {
aggs:{
wbs_item_id: {
terms: {
field: "wbs_item_id"
},
aggs: {
"total": {
"sum": {
"field": "total"
}
},
"invoiced": {
"sum": {
"field": "invoiced"
}
},
"forecast": {
"sum": {
"field": "forecast"
}
},
"committed": {
"sum": {
"field": "committed"
}
},
"accrued": {
"sum": {
"field": "accrued"
}
}
}
}
}
}
我还有一个wbs_parent_id字段,我想对其进行总计。像这样:
汽车(5)
水果(3)
您可以使用弹性搜索聚合来做到这一点吗?如果可以,怎么办?