Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enable inline (sandboxed) groovy scripts?

I'm trying to use this sample script query:

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

which results in the following error message:

"reason": "scripts of type [inline], operation [search] and lang [groovy] are disabled"

I've tried to enable scripting with this bit of elasticsearch.yml configuration:

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

Am I missing a setting?

like image 418
Sebastian Slutzky Avatar asked Feb 10 '16 11:02

Sebastian Slutzky


2 Answers

Setting the the following in elasticsearch.yml worked for me.

script.engine.groovy.inline.search: on
like image 69
AntonK Avatar answered Sep 20 '22 12:09

AntonK


thanks @Richa, I actually tried that but I got this error

script.disable_dynamic is not a supported setting, replace 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 then I tried just these three settings and it worked fine.

like image 35
Sebastian Slutzky Avatar answered Sep 19 '22 12:09

Sebastian Slutzky