Elasticsearch script - variable not defined
you can use "inline" although it is deprecated. now you alse can use "source" to replace "inline" for no warnings. for example:
"script" : {
"source": "ctx._source.tags.add(params.new_tag)",
"params": {
"new_tag":"tag1"
}
}
Your syntax is slightly off, if you have parameters you need to inline
the script. Try this:
curl -XPOST localhost:9200/website/blog/1/_update?pretty -d '{
"script" : {
"inline": "ctx._source.tags.add(params.new_tag)",
"params" : {
"new_tag" : "tag2"
}
}
}'