Hello - I'm trying to use Transport Client (java) to perform CRUD operations on ES document. I have two cases where I want to override whole inner object (meaning I want the existing inner object in ES to be overwritten) and another case is just update the inner object (meaning if the fields already exists in the innner object then it should update field value, else new fields should be added to the inner object). Below is my sample document in that "tags" field is the inner object.
{
"user" : "xyz",
"tags" : {
"code" : "SF",
"subsidiary" : "SF_DA"
}
}
Case # 1 :
As mentioned above, if I want to completely override the existing tags field the document should look as below.
{
"user" : "xyz",
"tags" : {
"company" : "PRO",
"city" : "Omaha"
}
}
Case # 2 :
As mentioned above, if I want to update existing fields in the tags field or add any new fields, the document should look as below
{
"user" : "xyz",
"tags" : {
"code" : "ADP",
"subsidiary" : "SF_DA",
"city" : "Omaha"
}
}
If I use prepareUpdate() api then I'm able to achieve only Case # 2 but not Case #1. Is there any way I can achieve Case # 1 as well with partial update of the inner object. Any response is highly appreciated. Thanks!