Script in Create Scripted Field form


(Ilia Katz) #1

Is it possible to use anything but Lucene expressions in the "Create Scripted Field" form (in the "Script" input)? I use Groovy scripts in "Advanced"->"JSON Input" but I was wondering if it is possible to specify the script in the scripted field "definition".


(CJ Cenizal) #2

Hi Ilia, I'm not very familiar with scripted fields, but I found a previous thread which looks like it may be useful to you.

In this thread, the user was able to enable groovy scripts on Elasticsearch, create a scripted field, and then manually override the scripted field inside of the visualization by editing the aggregation bucket under the "Advanced" toggle: Kibana Groovy Scripted Field for Aggregation: Visualize: Unsupported script value

Hope this helps,
CJ


(CJ Cenizal) #3

Here's another thread which seems to indicate a different way of enabling groovy scripts on Elasticsearch. If the first thread doesn't help you, this one might: Script_lang not supported [groovy] error for script_fields


(Ilia Katz) #4

Thanks a lot @cjcenizal!

In was already familiar with that thread. After going over it again I found what I was looking for.

The script needs to go to the "Create Scripted Field" form, to the "Script" input

Then, in the Visualization, in the Advanced->Json Input one needs to specify {"script": {"lang":"groovy"}}.


(CJ Cenizal) #5

Awesome! I'm glad you found your answer! Thanks a lot for posting it here, too. I'm sure someone else will come along with the same question and this will really help them out.

CJ


(system) #6