Update Nested

Hi,
I'm using ES 6.2.2.

Could I update a nested object with a new value while keeping the already indexed values?

POST /people/_doc/100
{
            "num" : [
             {
              "numero":"789456123",
              "favoris":true
              },
              {
              "numero":"123456798",
              "favoris":false
              }]}

The Nested hold two set of value, and I would like to index a third one:

POST /people/_doc/100/_update
{
   "script" : {
        "lang": "painless",
        "source": "ctx._source.num =params.new",
        "params" : {
            "new" : [
             {
              "numero":"456789123",
              "favoris": false
              }]}}}

But with this syntax the new one replace the previous set.
Could I put something like :
"source":"ctx._source.num =ctx._source.siret && params.new",
Or:
"source":"ctx._source.num =ctx._source.siret + params.new", ?

I know that ES have to reindex the whole thing each time, but I don't understand how to do it with a nested object when I easily could with a normal field.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.