Sum of bucket script

I am trying to achieve sum of bucket script values, Is it possible?

{
"aggs": {
"NAME": {
"terms": {
"field": "date",
"size": 10
},
"aggs": {
"bal": {
"sum": {
"field": "balance"
}
},
"rdb" : {
"sum": {
"field": "rdb"
}
},
"total" : {
"bucket_script": {
"buckets_path": {
"bal" : "bal",
"rpb" : "rdb"
},
"script": "params.bal * params.rpb"
}
},
"sum_of_total" : {
"sum_bucket": {
"buckets_path": "total"
}
}
}
}
}
}

getting the below error
How to achieve sum of total?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.