# Advanced JSON input option in Datatable is not supporting aggregation

**URL:** https://discuss.elastic.co/t/advanced-json-input-option-in-datatable-is-not-supporting-aggregation/227088
**Category:** Kibana
**Created:** [April 8, 2020, 9:23am UTC](https://discuss.elastic.co/t/advanced-json-input-option-in-datatable-is-not-supporting-aggregation/227088 "2020-04-08T09:23:20Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![RamyaGowda](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ramyagowda/32/27440_2.png) [@RamyaGowda](https://discuss.elastic.co/u/RamyaGowda)
#### Post date: [April 8, 2020, 9:23am UTC](https://discuss.elastic.co/t/advanced-json-input-option-in-datatable-is-not-supporting-aggregation/227088/1 "2020-04-08T09:23:20Z")

</div>

Hello Team,

I am trying to take a percentage value using two fields in data table visualization , though Data tables doesn't support bucket script or Math ,i am trying to write my aggregation query inside Advanced option

Below is the query which i am trying to put in Advanced option

> {  
> "aggs": {  
> "dentination\_wise": {  
> "terms": {  
> "field": "CALLED\_NUMBER\_COUNTRY\_ABBR.keyword",  
> "size": 20  
> },  
> "aggs": {  
> "sumofin": {  
> "sum": {  
> "field": "INCOMING\_TRUNK\_PRESENT"  
> }  
> },  
> "sumofcs": {  
> "sum": {  
> "field": "CALL\_ANSWER\_STATUS"  
> }  
> },  
> "percentage": {  
> "bucket\_script": {  
> "buckets\_path": {  
> "my\_var1": "sumofcs",  
> "my\_var2": "sumofin"  
> },  
> "script": "params.my\_var1 / params.my\_var2\*100"  
> }  
> }  
> }  
> }  
> }  
> }

But I am getting an Internal Server Error, Is it something not supported by Elasticsearch, What are the other option to take out percentage value then? except Visual Builder. Seeking your help ☹

Thanks  
Ramya

---

<div class="post-metadata">

### Author: ![flash1293](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/flash1293/32/41227_2.png) [@flash1293](https://discuss.elastic.co/u/flash1293)
#### Post date: [April 9, 2020, 7:25am UTC](https://discuss.elastic.co/t/advanced-json-input-option-in-datatable-is-not-supporting-aggregation/227088/2 "2020-04-09T07:25:20Z")

</div>

Advanced JSON input can only extend additional config for the aggregation you selected, you can't use it to execute other aggregations. For calculating percentages like this you currently have to use visual builder or vega (you can freely specify your Elasticsearch query there).

---

<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: [May 7, 2020, 7:25am UTC](https://discuss.elastic.co/t/advanced-json-input-option-in-datatable-is-not-supporting-aggregation/227088/3 "2020-05-07T07:25:23Z")

</div>

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