My first post here. So please bear with me.
Sample document:
{
"persons" : [
{
"id" : "1",
"name" : "John Doe"
},
{
"id" : "2",
"name" : "Jane Doe"
}
]
}
I would like to add a new field named "calcValue" to each person object as follows:
calcValue = id + '#' + name
Tried foreach processor but getting concurrent modification exception.
"processors": [
{
"foreach": {
"field": "persons",
"processor": {
"script": {
"source": "ctx.persons.add(params.calcValue)",
"params": {
"calcValue": "_ingest._value.id+'#'+_ingest._value.name"
}
}
}
}
}
I understand why ConcurrentModificationException was raised but I am unable to get this working. Please can someone help.
