Is there any option to turn on groovy script in kibana?


(Daye Jeong) #1

First, sorry for my poor english.

I want to use groovy script in kibana.(scripted field in index, or JSON input in visualization)

My kibana version is 4.5.3

And my es setting like this:
script.engine.groovy.indexed.aggs: true
script.engine.groovy.inline.aggs: true
script.engine.groovy.inline.mapping: true
script.engine.groovy.inline.search: true
script.engine.groovy.inline.update: true
script.engine.groovy.inline.plugin: true
script.inline: true
script.indexed: true
script.groovy.sandbox.enabled: true

and I use shield.

Anyway, I tried some script. (Kibana Groovy Scripted Field for Aggregation: Visualize: Unsupported script value)
In the web page, It seems to able using groovy script in kibana.

  1. kibana(4.5.3), add scripted field:
    doc['date'].date.dayOfWeek().get()+'_'+doc['date'].date.dayOfWeek().getAsText()

when I clicked "discover" button, there was a error message like below.

Error: Request to Elasticsearch failed: {"error":{"root_cause":[{"type":"lexer_no_viable_alt_exception","reason":"lexer_no_viable_alt_exception: null"}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"*****","node":"g2yHBlh9R5K58NXUmNDNEw","reason":{"type":"script_exception","reason":"Failed to compile inline script [doc['date'].date.dayOfWeek().get()+''+doc['date'].date.dayOfWeek().getAsText()] using lang [expression]","caused_by":{"type":"script_exception","reason":"Failed to parse expression: doc['date'].date.dayOfWeek().get()+''+doc['date'].date.dayOfWeek().getAsText()","caused_by":{"type":"parse_exception","reason":"parse_exception: unexpected character '.g' on line (1) position (28)","caused_by":{"type":"lexer_no_viable_alt_exception","reason":"lexer_no_viable_alt_exception: null"}}}}}]}}

  1. In the visualization editor, tried this script as JSON Input
    {
    "script": "doc['date'].date.dayOfWeek().getAsText()",
    "lang" : "groovy",
    "valueType": "string"
    }

Error: Request to Elasticsearch failed: {"error":{"root_cause":[{"type":"class_cast_exception","reason":"class_cast_exception: java.lang.String cannot be cast to java.lang.Number"}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"******","node":"g2yHBlh9R5K58NXUmNDNEw","reason":{"type":"class_cast_exception","reason":"class_cast_exception: java.lang.String cannot be cast to java.lang.Number"}}]}}

Is anyone have a same issue like me?

Is there any option to turn on groovy script?
Can shield affect using script?

I really need some help...


(Daye Jeong) #2

I want to use script on string field.. (not metric..)
like "Total " + doc['somthing'].value


(system) #3