How to enable inline (isolated) groovy scripts?

I am trying to use this sample request script:

POST /_search { "script_fields": { "my_field": { "script": "1 + my_evar", "params": { "my_evar": 2 } } } } 

which leads to the following error message:

"reason": "scripts like [inline], operations [search] and lang [groovy] are disabled"

I tried to include scripts with this elasticsearch.yml configuration bit:

 script.inline: true script.indexed: true script.search: true script.update: true script.mapping: true script.groovy.sandbox.enabled: true 

Am I missing settings?

+5
source share
3 answers

For me, setting elasticsearch.yml worked.

 script.engine.groovy.inline.search: on 
+7
source

thanks @Richa, I really tried this, but I got this error

script.disable_dynamic is not supported, replace it with fine-grained script settings. Dynamic scripts can be enabled for all languages ​​and all operations by replacing script.disable_dynamic: false with script.inline: on and script.indexed: on

So, I tried only these three settings, and it worked fine.

+3
source

Use the following settings:

 script.disable_dynamic: false 
+1
source

Source: https://habr.com/ru/post/1242696/


All Articles