# Parent/child relationships

**URL:** <https://discuss.elastic.co/t/parent-child-relationships/3733>\
**Category:** Elasticsearch\
**Created:** [January 3, 2011, 7:28pm UTC](https://discuss.elastic.co/t/parent-child-relationships/3733 "2011-01-03T19:28:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dan\_Gould](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dan_gould/32/3290_2.png) [@Dan\_Gould](https://discuss.elastic.co/u/Dan_Gould)\
**Post date:** [January 3, 2011, 7:28pm UTC](https://discuss.elastic.co/t/parent-child-relationships/3733/1 "2011-01-03T19:28:34Z")

</div>

Hi,

I'm looking at starting to use ElasticSearch in a new project. I'm  
just starting, but but looks great so far.

I ran across the new parent/child relationship support. In my use-  
case, we will keep appending stuff to documents, and the stuff we  
append with be considered part of the document. Since parent/child is  
so new, I don't see much on it yet.

Imagine a blog with comments, where the comments are considered part  
of the document. So, as each comment is added, could I add it as a  
child document (without having to re-index the whole main document and  
existing comments)? Is this a good solution? Will it cause any  
problems/while I lose any functionality?

Also, will it work with more\_like\_this queries?

If not, is there a better way to append stuff to documents without re-  
sending the whole document?

Thanks,  
Dan

---

<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:** [January 4, 2011, 4:45pm UTC](https://discuss.elastic.co/t/parent-child-relationships/3733/2 "2011-01-04T16:45:05Z")

</div>

Currently, the main use case for parent child (with the current set of  
features) is filtering based on highly dynamic data that is not required to  
be fetched / highlighted with the parent doc itself.

As to solving the blog and comment same, it really depends on how you  
envision your search interface to look like. Will it return just posts, just  
comments, both? You can always store them as two different types and just  
execute the query, you will get back both posts and comments. The comment  
can have (using parent mapping for example, but not required) a reverse id  
of the blog post.

On Mon, Jan 3, 2011 at 9:28 PM, Dan Gould [dlg@dangould.com](mailto:dlg@dangould.com) wrote:

> Hi,
> 
> I'm looking at starting to use Elasticsearch in a new project. I'm  
> just starting, but but looks great so far.
> 
> I ran across the new parent/child relationship support. In my use-  
> case, we will keep appending stuff to documents, and the stuff we  
> append with be considered part of the document. Since parent/child is  
> so new, I don't see much on it yet.
> 
> Imagine a blog with comments, where the comments are considered part  
> of the document. So, as each comment is added, could I add it as a  
> child document (without having to re-index the whole main document and  
> existing comments)? Is this a good solution? Will it cause any  
> problems/while I lose any functionality?
> 
> Also, will it work with more\_like\_this queries?
> 
> If not, is there a better way to append stuff to documents without re-  
> sending the whole document?
> 
> Thanks,  
> Dan

---

<div class="post-metadata">

**Author:** ![Dan\_Gould](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dan_gould/32/3290_2.png) [@Dan\_Gould](https://discuss.elastic.co/u/Dan_Gould)\
**Post date:** [January 6, 2011, 4:47am UTC](https://discuss.elastic.co/t/parent-child-relationships/3733/3 "2011-01-06T04:47:32Z")

</div>

Thank you Shay. It sounds like Parent/Chlld would be a win, but  
doesn't do everything I'll need.

(What would be amazing for my use-case would be if the child nodes  
could be treated as fully part of the document. Or if there was an  
append function for documents.)

In any case, ES looks great--tx.

On Jan 4, 8:45 am, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:

> Currently, the main use case for parent child (with the current set of  
> features) is filtering based on highly dynamic data that is not required to  
> be fetched / highlighted with the parent doc itself.
> 
> As to solving the blog and comment same, it really depends on how you  
> envision your search interface to look like. Will it return just posts, just  
> comments, both? You can always store them as two different types and just  
> execute the query, you will get back both posts and comments. The comment  
> can have (using parent mapping for example, but not required) a reverse id  
> of the blog post.
> 
> On Mon, Jan 3, 2011 at 9:28 PM, Dan Gould [d...@dangould.com](mailto:d...@dangould.com) wrote:
> 
> > Hi,
> 
> > I'm looking at starting to use Elasticsearch in a new project. I'm  
> > just starting, but but looks great so far.
> 
> > I ran across the new parent/child relationship support. In my use-  
> > case, we will keep appending stuff to documents, and the stuff we  
> > append with be considered part of the document. Since parent/child is  
> > so new, I don't see much on it yet.
> 
> > Imagine a blog with comments, where the comments are considered part  
> > of the document. So, as each comment is added, could I add it as a  
> > child document (without having to re-index the whole main document and  
> > existing comments)? Is this a good solution? Will it cause any  
> > problems/while I lose any functionality?
> 
> > Also, will it work with more\_like\_this queries?
> 
> > If not, is there a better way to append stuff to documents without re-  
> > sending the whole document?
> 
> > Thanks,  
> > Dan

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 4:14am UTC](https://discuss.elastic.co/t/parent-child-relationships/3733/4 "2017-07-06T04:14:13Z")

</div>


