the demo document:
curl -XPUT http://localhost:9200/blog/article/1 -d '{"title": "New version of Elasticsearch released!", "content": "Version 1.0 released today!", "tags": ["announce","elasticsearch", "release"]}'
then i want add a field:
curl -XPOST http://localhost:9200/blog/article/1/_update -d '{"script": "ctx._source.counter += 1","upsert": {"counter" : 0}}'
I get the msg:
{
"error": {
"root_cause": [
{
"type": "remote_transport_exception",
"reason": "[Delphine Courtney][127.0.0.1:9300][indices:data/write/update[s]]"
}
],
"type": "illegal_argument_exception",
"reason": "failed to execute script",
"caused_by": {
"type": "script_exception",
"reason": "failed to run inline script [ctx._source.counter += 1] using lang [groovy]",
"caused_by": {
"type": "null_pointer_exception",
"reason": "Cannot execute null+1"
}
}
},
"status": 400
}
my config file content:
script.inline: on script.indexed: on script.engine.groovy.inline.aggs: on script.engine.groovy.inline.update: on
i'm a newcomer.
thank you.