I'm new to elasticsearch and I'm tryng to set-up a project for upsert data in elastisearch I have the following document:
{
"PropertyOne": "propertyone",
"PropertyTwo": "propertytwo",
"MyArray": [
{
"FirstObjArrayPropertyOne": "ArrayPropertyOne",
"FirstObjArrayPropertyTwo": "ArrayPropertyTwo",
},
{
"SecondObjArrayPropertyOne": "ArrayPropertyOne",
"SecondObjArrayPropertyTwo": "ArrayPropertyTwo",
}
]
}
Now I would like to replace the value of "MyArray" and it will looks like:
{
"PropertyOne": "propertyone",
"PropertyTwo": "propertytwo",
"MyArray": [
{
"NewObjectOne": "ArrayPropertyOne",
"NewObjectOne": "ArrayPropertyTwo"
},
{
"NewObjectTwo": "ArrayPropertyOne",
"NewObjectTwo": "ArrayPropertyTwo"
},
{
"NewObjectThree": "ArrayPropertyOne",
"NewObjectThree": "ArrayPropertyTwo"
}
]
}
I use Nest Api for .NET and I create a painless script as follow
ctx._source.MyArray = [
{
"NewObjectOne": "ArrayPropertyOne",
"NewObjectOne": "ArrayPropertyTwo"
},
{
"NewObjectTwo": "ArrayPropertyOne",
"NewObjectTwo": "ArrayPropertyTwo"
},
{
"NewObjectThree": "ArrayPropertyOne",
"NewObjectThree": "ArrayPropertyTwo"
}
]
And the error is
{Type: script_exception Reason: "compile error" CausedBy: "Type: illegal_argument_exception Reason: "invalid sequence of tokens near ['{']." CausedBy: "Type: no_viable_alt_exception Reason: """"}
Any suggestions?
Thanks in advice