# Bucket script parsing\_exception error

**URL:** <https://discuss.elastic.co/t/bucket-script-parsing-exception-error/107203>\
**Category:** Elasticsearch\
**Created:** [November 10, 2017, 2:47pm UTC](https://discuss.elastic.co/t/bucket-script-parsing-exception-error/107203 "2017-11-10T14:47:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Frank\_Matera](https://avatars.discourse-cdn.com/v4/letter/f/ba9def/32.png) [@Frank\_Matera](https://discuss.elastic.co/u/Frank_Matera)\
**Post date:** [November 10, 2017, 2:47pm UTC](https://discuss.elastic.co/t/bucket-script-parsing-exception-error/107203/1 "2017-11-10T14:47:46Z")

</div>

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](http://params.Com) / params.Att \*100"  
}  
}  
}

---

<div class="post-metadata">

**Author:** ![rjernst](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rjernst/32/6363_2.png) [@rjernst](https://discuss.elastic.co/u/rjernst)\
**Post date:** [November 17, 2017, 5:59pm UTC](https://discuss.elastic.co/t/bucket-script-parsing-exception-error/107203/2 "2017-11-17T17:59:25Z")

</div>

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

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

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 15, 2017, 5:59pm UTC](https://discuss.elastic.co/t/bucket-script-parsing-exception-error/107203/3 "2017-12-15T17:59:29Z")

</div>

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