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?