How to append new document to a nested field?


(Red) #1

how to append new document to a nested field?


(David Pilato) #2

An example?


(Red) #4

Red1m
does this question need an example?

any nested fields.

{
      "nested_field":[
         {"id":1},
         {"id":2}
      ]
}

then, i want to add “id”:3 to the nested_field, how?


(David Pilato) #5
PUT index/doc/1
{
      "nested_field":[
         {"id":1},
         {"id":2},
         {"id":3}
      ]
}

(Red) #6

is there any way appending object to the end?
not the way recreate the field.
this will cost a lot when the field is very large.

how about using script which loads all data then restore to the field with new data.
may this reduce the cost of network transmit?

and creating one field one time a day is acceptable


(David Pilato) #7

The update API does that: https://www.elastic.co/guide/en/elasticsearch/reference/5.5/docs-update.html


(Red) #8

thank for your patience.
my English is bad


(system) #9

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