Sebastian Slutzky
Sebastian Slutzky

Reputation: 379

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?

Upvotes: 6

Views: 10429

Answers (3)

AntonK
AntonK

Reputation: 2320

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

script.engine.groovy.inline.search: on

Upvotes: 7

Sebastian Slutzky
Sebastian Slutzky

Reputation: 379

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.

Upvotes: 4

Richa
Richa

Reputation: 7649

Use this settings:

script.disable_dynamic: false

Upvotes: 1

Related Questions