GET vehflowinfo/_search
{
"size" : 0,
"aggs": {
"aggs_glbm": {
"terms": {
"field": "glbmfr.keyword"
},
"aggs": {
"aggs_ywlx": {
"terms": {
"field": "ywlx.keyword"
},
"aggs": {
"perGLBM_In_Total": {
"bucket_script": {
"buckets_path": {
"perGLBM_ywlx": "_count",
"total": "aggs_glbm._count"
},
"script": "params.perGLBM_ywlx / params.total"
}
}
}
}
}
}
}
}
按照管理部门(glbmfr)和业务类型(ywlx)层级聚合后,要计算每个管理部门下面每种业务所占给部门业务总数的百分比
如上,我在bucket_script中怎么拿到该部门的总数,求大神指点?
{
"size" : 0,
"aggs": {
"aggs_glbm": {
"terms": {
"field": "glbmfr.keyword"
},
"aggs": {
"aggs_ywlx": {
"terms": {
"field": "ywlx.keyword"
},
"aggs": {
"perGLBM_In_Total": {
"bucket_script": {
"buckets_path": {
"perGLBM_ywlx": "_count",
"total": "aggs_glbm._count"
},
"script": "params.perGLBM_ywlx / params.total"
}
}
}
}
}
}
}
}
按照管理部门(glbmfr)和业务类型(ywlx)层级聚合后,要计算每个管理部门下面每种业务所占给部门业务总数的百分比
如上,我在bucket_script中怎么拿到该部门的总数,求大神指点?
1 个回复
strglee
赞同来自: dulang