Index Nested object 6.2



I've read that Elasticsearch's Nested object are usefull but aren't independant from their root index and
reindex the whole document if reindexed (

But on the up to date documentation (6.2) it is said that "nested documents are indexed as separate documents" (

So I want to be sure, If I use this structure and reindex a Nested object, does it reindex the root index? Does it reindex the other nested object in the root index?

(Christian Dahlqvist) #2

Yes, it does reindex the entire nested document, including root and all nested documents.


But let's say that in my Index "Personne" which got numerous field in which there is "name",
I have PUT two entity, Peter (_id : 1) and Alice (_id : 2).
There is also a nested object in Personne to keep their different mail adresses.
I have posted and to the _id2 and to the _id1.

Now let's say that I change the adress of alice so that she got a second adress as well.

POST Personne/_doc/2/_update
    "script" : {
        "lang": "painless",
        "source": "ctx._source.mail = params.mail",
        "params" : {
            "mail" : [
             "mail1" : "",
            "mail2" : ""

What would be reindexed? Every field concerning Alice (her name, both of her mails)?
Everything inside Personne (including everything concerning Peter) ?

(Christian Dahlqvist) #4

The entire document will be reindexed, the root as well as all nested documents. If I have a root document with a list of 5 nested documents and add another one, all 7 documents will be (re)indexed.


Thanks for your answers and sorry to bother you @Christian_Dahlqvist but I may haven't make myself comprehensible.
I don't mean that the root will be re-indexed as the mapping/schema will be changed.
I mean that if I add a nested object as in I add data (this person will have another mail adress). Will the index of the data of the person be reindexed/updated?

I want to add nested object causing as less operation as possible.

(Christian Dahlqvist) #6

Yes, that is what I have tried to explain. Updating a nested document can be expensive.


Thanks for your answer. :wink:

(system) #8

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