# Choosing Parent/Child vs Nested Document

**URL:** <https://discuss.elastic.co/t/choosing-parent-child-vs-nested-document/6742>\
**Category:** Elasticsearch\
**Created:** [February 18, 2012, 8:31am UTC](https://discuss.elastic.co/t/choosing-parent-child-vs-nested-document/6742 "2012-02-18T08:31:43Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [February 29, 2012, 1:55pm UTC](https://discuss.elastic.co/t/choosing-parent-child-vs-nested-document/6742/6 "2012-02-29T13:55:38Z")

</div>

++Harm

On Tuesday, February 28, 2012 at 1:18 PM, haarts wrote:

> I'm not Shay (not by a long shot) but I do know the answer to that one!  
> Your assumption is correct. An update allows you to append stuff to the document without sending it over the wire entirely. It also handles conflicts (see retry\_on\_conflict argument). But the entire document _is_ reindexed which can be rather expensive. Adding tags probably wouldn't be a problem. Added (hundreds of) comments to a blog post is a problem.
> 
> Harm
> 
> On Tuesday, 28 February 2012 11:37:19 UTC+1, Karel Minařík wrote:
> 
> > Shay, do I understand correctly, that the update API [http://  
> > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/update.html) ([Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/update.html))] enables to  
> > append "nested" documents to the "main" document, such as adding a tag  
> > or comment to an article, without requiring to send the full document  
> > over the wire? (And also without potential conflicts with concurrent  
> > updates?)
> > 
> > Karel
> > 
> > On Feb 20, 1:58 pm, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:
> > 
> > > Both parent/child or nested documents will have the relevant data reside in the same shard. The main difference is that nested are faster compared to parent/child, but, nested docs require reindexing the parent with all its children, while parent child allows to reindex / add / delete specific children.
> 
> On Tuesday, 28 February 2012 11:37:19 UTC+1, Karel Minařík wrote:
> 
> > Shay, do I understand correctly, that the update API [http://  
> > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/update.html) ([Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/update.html))] enables to  
> > append "nested" documents to the "main" document, such as adding a tag  
> > or comment to an article, without requiring to send the full document  
> > over the wire? (And also without potential conflicts with concurrent  
> > updates?)
> > 
> > Karel
> > 
> > On Feb 20, 1:58 pm, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:
> > 
> > > Both parent/child or nested documents will have the relevant data reside in the same shard. The main difference is that nested are faster compared to parent/child, but, nested docs require reindexing the parent with all its children, while parent child allows to reindex / add / delete specific children.
> 
> On Tuesday, 28 February 2012 11:37:19 UTC+1, Karel Minařík wrote:
> 
> > Shay, do I understand correctly, that the update API [http://  
> > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/update.html) ([Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/update.html))] enables to  
> > append "nested" documents to the "main" document, such as adding a tag  
> > or comment to an article, without requiring to send the full document  
> > over the wire? (And also without potential conflicts with concurrent  
> > updates?)
> > 
> > Karel
> > 
> > On Feb 20, 1:58 pm, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:
> > 
> > > Both parent/child or nested documents will have the relevant data reside in the same shard. The main difference is that nested are faster compared to parent/child, but, nested docs require reindexing the parent with all its children, while parent child allows to reindex / add / delete specific children.
> 
> On Tuesday, 28 February 2012 11:37:19 UTC+1, Karel Minařík wrote:
> 
> > Shay, do I understand correctly, that the update API [http://  
> > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/update.html) ([Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/update.html))] enables to  
> > append "nested" documents to the "main" document, such as adding a tag  
> > or comment to an article, without requiring to send the full document  
> > over the wire? (And also without potential conflicts with concurrent  
> > updates?)
> > 
> > Karel
> > 
> > On Feb 20, 1:58 pm, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:
> > 
> > > Both parent/child or nested documents will have the relevant data reside in the same shard. The main difference is that nested are faster compared to parent/child, but, nested docs require reindexing the parent with all its children, while parent child allows to reindex / add / delete specific children.

---

_[View the full topic](https://discuss.elastic.co/t/choosing-parent-child-vs-nested-document/6742)._
