# Why using parent/child relationship instead of a simple parent\_id relation?

**URL:** https://discuss.elastic.co/t/why-using-parent-child-relationship-instead-of-a-simple-parent-id-relation/12260
**Category:** Elasticsearch
**Created:** [June 4, 2013, 4:50pm UTC](https://discuss.elastic.co/t/why-using-parent-child-relationship-instead-of-a-simple-parent-id-relation/12260 "2013-06-04T16:50:56Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Mathieu\_Roy](https://avatars.discourse-cdn.com/v4/letter/m/9de0a6/32.png) [@Mathieu\_Roy](https://discuss.elastic.co/u/Mathieu_Roy)
#### Post date: [June 4, 2013, 4:50pm UTC](https://discuss.elastic.co/t/why-using-parent-child-relationship-instead-of-a-simple-parent-id-relation/12260/1 "2013-06-04T16:50:56Z")

</div>

I am asking myself why i would use a parent/child relationship to retrieve  
childs docs instead of creating a parent\_id field in childs documents and  
query on this field?

thank you

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![mattweber](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mattweber/32/44940_2.png) [@mattweber](https://discuss.elastic.co/u/mattweber)
#### Post date: [June 4, 2013, 4:57pm UTC](https://discuss.elastic.co/t/why-using-parent-child-relationship-instead-of-a-simple-parent-id-relation/12260/2 "2013-06-04T16:57:58Z")

</div>

Because you can execute queries against the parents and have the children  
of the matching documents returned or vice versa. It is much more powerful  
than simple filtering of a field.

On Tue, Jun 4, 2013 at 9:50 AM, Mathieu Roy [mr.math.roy@gmail.com](mailto:mr.math.roy@gmail.com) wrote:

> I am asking myself why i would use a parent/child relationship to retrieve  
> childs docs instead of creating a parent\_id field in childs documents and  
> query on this field?
> 
> thank you
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![Mathieu\_Roy](https://avatars.discourse-cdn.com/v4/letter/m/9de0a6/32.png) [@Mathieu\_Roy](https://discuss.elastic.co/u/Mathieu_Roy)
#### Post date: [June 4, 2013, 5:41pm UTC](https://discuss.elastic.co/t/why-using-parent-child-relationship-instead-of-a-simple-parent-id-relation/12260/3 "2013-06-04T17:41:01Z")

</div>

ah ok, i understand better now.

Thank you

Le mardi 4 juin 2013 12:57:58 UTC-4, Matt Weber a écrit :

> Because you can execute queries against the parents and have the children  
> of the matching documents returned or vice versa. It is much more powerful  
> than simple filtering of a field.
> 
> On Tue, Jun 4, 2013 at 9:50 AM, Mathieu Roy \<[mr.ma...@gmail.com](mailto:mr.ma...@gmail.com)\<javascript:\>
> 
> > wrote:
> 
> > I am asking myself why i would use a parent/child relationship to  
> > retrieve childs docs instead of creating a parent\_id field in childs  
> > documents and query on this field?
> > 
> > thank you
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:33am UTC](https://discuss.elastic.co/t/why-using-parent-child-relationship-instead-of-a-simple-parent-id-relation/12260/4 "2017-07-06T02:33:02Z")

</div>


