Kibana 5 alpha 4 script in JSON Input

I am trying to add a groovy script for a bucket in the Advanced section in JSON Input when creating a visualization. It works perfectly well in Kibana 4 but it doesn't work in Kibana 5 alpha 4. Needless to say thay I enabled groovy in the elasticsearch.yml.

{"script" : "doc['iteration_duration'].value", "lang": "groovy"}

I am getting the following error

Visualize: [parsing_exception] Unexpected token VALUE_STRING [script] in [24]., with { line=1 col=754 }

The above works well in Kibana 4. Any suggestions?

Hi @mrvincnezo,

The syntax for specifying scripts in the aggregation DSL has become stricter in 5.0. Instead of:

{"script" : "doc['iteration_duration'].value", "lang": "groovy"}

Try this:

{ "script": { "inline": "doc['bytes'].value", "lang": "groovy" } }

2 Likes

Thanks @shaunak. That worked perfectly.

Thanks, it's working !

shaunak: your solution works. How come I still see the error message even though the chart shows up? Thanks.