Description
Elasticsearch version (bin/elasticsearch --version
):
Version: 6.1.1, Build: bd92e7f/2017-12-17T20:23:25.338Z, JVM: 1.8.0_151
Plugins installed:
["x-pack"]
JVM version (java -version
):
java version "1.8.0_151"
Java(TM) SE Runtime Environment (build 1.8.0_151-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode)
OS version (uname -a
if on a Unix-like system):
Darwin MacPro.local 17.3.0 Darwin Kernel Version 17.3.0: Thu Nov 9 18:09:22 PST 2017; root:xnu-4570.31.3~1/RELEASE_X86_64 x86_64
Description of the problem including expected versus actual behavior:
I'm unable to use stored scripts to update by query. Elasticsearch is returning "lang cannot be specified for stored scripts
error.
Steps to reproduce:
- Create a stored script
POST _scripts/dummy_script
{
"script": {
"source": "ctx._source.my_field = 8",
"lang": "painless"
}
}
Please note that "lang" parameter is obligatory here.
- Index a test document:
PUT test/foo/1
{
"my_field": 10,
"user_id": 12
}
- Try to update by query:
POST test/_update_by_query
{
"query": {
"term": {
"user_id": 12
}
},
"script": {
"id": "dummy_script"
}
}
Response:
{
"error": {
"root_cause": [
{
"type": "illegal_argument_exception",
"reason": "lang cannot be specified for stored scripts"
}
],
"type": "illegal_argument_exception",
"reason": "lang cannot be specified for stored scripts"
},
"status": 400
}
Provide logs (if relevant): No logs are emitted.