Elasticsearch how to use script (file) in update

I would like to update one document; using saved script

curl -XPOST 'http://localhost:9200/customer92/listbuilder/a10/_update' -d ' { "_script": { "script":"summarization" } }' 

I have summarization.groovy in my config / scripts folder. I get the following error:

 { "error": "ElasticsearchIllegalArgumentException[failed to execute script]; nested: GroovyScriptExecutionException[MissingPropertyException[No such property: summarization for class: Script6]]; ", "status":400 } 

What am I doing wrong?

+6
source share
1 answer

I am sure this question is no longer relevant, but in case anyone is interested is still here:

the "script" field in json should be the actual script not the name of the script. in your case script_id will be correct, you should also add the language name if the default value has not been changed.

curl -XPOST 'http://localhost:9200/customer92/listbuilder/a10/_update' -d ' { "script_id":"summarization", "lang": "groovy" }'

See: Indexed Scripts and API Update for more details.

-1
source

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


All Articles