I am trying to append a nested field value using java api.
Here is my doc structure:
{
"Name" : "ABC",
"Tag" : { [
"Tag1" : "DEF"
]}
}
How do I append another Tag1 value so that final doc looks like this:
{
"Name" : "ABC",
"Tag" : { [
"Tag1" : "DEF",
"Tag1" : "GHI"
]}
}
Following is the script that I use:
UpdateRequest updateRequest = new UpdateRequest("test", "testing", "1")
.script(new Script("ctx._source.Tag.Tag1 += "+ TagValue ));
client.update(updateRequest).get();
What is the correct way to access and append new Tag1 values?