# Can a child document have multiple parents?

**URL:** <https://discuss.elastic.co/t/can-a-child-document-have-multiple-parents/6407>\
**Category:** Elasticsearch\
**Created:** [January 17, 2012, 5:33am UTC](https://discuss.elastic.co/t/can-a-child-document-have-multiple-parents/6407 "2012-01-17T05:33:45Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nick\_Hoffman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nick_hoffman/32/1872_2.png) [@Nick\_Hoffman](https://discuss.elastic.co/u/Nick_Hoffman)\
**Post date:** [January 17, 2012, 5:33am UTC](https://discuss.elastic.co/t/can-a-child-document-have-multiple-parents/6407/1 "2012-01-17T05:33:45Z")

</div>

Hey guys. In a parent-child relationship, can a child have multiple  
parents? If not, is the only workaround to create multiple copies of the  
child, once for each of its parents?

Thanks,  
Nick

---

<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 17, 2012, 9:57am UTC](https://discuss.elastic.co/t/can-a-child-document-have-multiple-parents/6407/2 "2012-01-17T09:57:36Z")

</div>

No, it can't, because the parent controls which shard the child document  
will end at (it has to be on the same shard as the parent document).

On Tue, Jan 17, 2012 at 7:33 AM, Nick Hoffman [nick@deadorange.com](mailto:nick@deadorange.com) wrote:

> Hey guys. In a parent-child relationship, can a child have multiple  
> parents? If not, is the only workaround to create multiple copies of the  
> child, once for each of its parents?
> 
> Thanks,  
> Nick

---

<div class="post-metadata">

**Author:** ![Nick\_Hoffman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nick_hoffman/32/1872_2.png) [@Nick\_Hoffman](https://discuss.elastic.co/u/Nick_Hoffman)\
**Post date:** [January 17, 2012, 2:45pm UTC](https://discuss.elastic.co/t/can-a-child-document-have-multiple-parents/6407/3 "2012-01-17T14:45:04Z")

</div>

That makes sense, though it makes it difficult to deal with children with  
multiple parents. Are there any other solutions besides indexing a copy of  
a child for each of its parents?

---

<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 18, 2012, 8:52pm UTC](https://discuss.elastic.co/t/can-a-child-document-have-multiple-parents/6407/4 "2012-01-18T20:52:35Z")

</div>

Nothing except for you doing it explicitly.

On Tue, Jan 17, 2012 at 4:45 PM, Nick Hoffman [nick@deadorange.com](mailto:nick@deadorange.com) wrote:

> That makes sense, though it makes it difficult to deal with children with  
> multiple parents. Are there any other solutions besides indexing a copy of  
> a child for each of its parents?

---

<div class="post-metadata">

**Author:** ![mihai](https://avatars.discourse-cdn.com/v4/letter/m/35a633/32.png) [@mihai](https://discuss.elastic.co/u/mihai)\
**Post date:** [December 19, 2013, 11:00am UTC](https://discuss.elastic.co/t/can-a-child-document-have-multiple-parents/6407/5 "2013-12-19T11:00:35Z")

</div>

As a developer, I can make sure that all the parents and the children  
reside in the same shard, and every additional child or parent will be  
routed to that shard.

Having this issue out of the way, can I set \_parent: [parent1, parent2,  
..., parentN]?

On Tuesday, January 17, 2012 9:57:36 AM UTC, kimchy wrote:

> No, it can't, because the parent controls which shard the child document  
> will end at (it has to be on the same shard as the parent document).
> 
> On Tue, Jan 17, 2012 at 7:33 AM, Nick Hoffman \<[ni...@deadorange.com](mailto:ni...@deadorange.com)\<javascript:\>
> 
> > wrote:
> 
> > Hey guys. In a parent-child relationship, can a child have multiple  
> > parents? If not, is the only workaround to create multiple copies of the  
> > child, once for each of its parents?
> > 
> > Thanks,  
> > Nick

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/881decec-8593-48ae-9162-90424178e7e9%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/881decec-8593-48ae-9162-90424178e7e9%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![James\_Cook\_2](https://avatars.discourse-cdn.com/v4/letter/j/b19c9b/32.png) [@James\_Cook\_2](https://discuss.elastic.co/u/James_Cook_2)\
**Post date:** [December 14, 2015, 1:32am UTC](https://discuss.elastic.co/t/can-a-child-document-have-multiple-parents/6407/6 "2015-12-14T01:32:36Z")

</div>

This is an older thread, but I second @mihal in asking, if the developer can make sure via routing that each document is on the same shard, is there any technical reason why multiple parents cannot be supported?

---

<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 5, 2017, 11:31pm UTC](https://discuss.elastic.co/t/can-a-child-document-have-multiple-parents/6407/7 "2017-07-05T23:31:26Z")

</div>


