Bucket script parsing_exception error

I am trying to calculate the percentage of 2 aggregated fields. The aggs return the expected values, but when I add the bucket script, I am receiving an error "Unknown key for a START_OBJECT in [Computing_ASR].", I am really new to this and was wondering if someone would be able to point out what I am doing incorrectly. Thanks in advance.
{
"query": {
"bool": {
"must": [
{ "match": { "call_ty": "10"} },
{ "match": { "otg.keyword": "agg-0002363334"} }
]
}
},
"size": 0,
"aggs": {
"Attempts": {
"value_count": { "field": "dur"}
},
"Completed":{
"range": {
"field": "dur",
"ranges": [
{ "from" : 1 }
]
}
}
},
"Computing_ASR": {
"bucket_script": {
"buckets_path": {
"Com": "Completed",
"Att": "Attempts"
},
"script": "params.Com / params.Att *100"
}
}
}

Your closing curly braces nesting is off. Notice there is one extra curly here:

"Completed":{
"range": {
"field": "dur",
"ranges": [
{ "from" : 1 }
]
}
}
},

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