Hi guys, I use Elasticsearch 2.2.0 and I tried to update array inside a source
here is my source
{
"list":[
{
"tweet_id":"1",
"a":"b"
},
{
"tweet_id":"123",
"a":"f"
}
]
}
you tried to write javascript as your scripting language (at least that's what I am interpreting here), but you need to use groovy here. Groovy does not have a concept called foreach, you may want to check out some groovy examples...
As an example (without knowing any of your data structure or having tested this)
Thanks for the answer. But when I use the script from above , it show error "Cannot get property 'list' on null object". But I have value on list array. Can you tell me what is going wrong here?? thank a lot
here is my properties setting
"list": {
"properties": {
"a": {
"type": "string"
},
"tweet_id": {
"type": "string"
}
}
},
and the error is :
{
"error": {
"root_cause": [
{
"type": "remote_transport_exception",
"reason": "[node1_ES2-2][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.list.each { }] using lang [groovy]",
"caused_by": {
"type": "null_pointer_exception",
"reason": "Cannot get property 'list' on null object"
}
}
},
"status": 400
}
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.