# Parent child creation in two different indices

**URL:** <https://discuss.elastic.co/t/parent-child-creation-in-two-different-indices/23142>\
**Category:** Elasticsearch\
**Created:** [April 8, 2015, 12:16am UTC](https://discuss.elastic.co/t/parent-child-creation-in-two-different-indices/23142 "2015-04-08T00:16:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pavanbnv](https://avatars.discourse-cdn.com/v4/letter/p/958977/32.png) [@pavanbnv](https://discuss.elastic.co/u/pavanbnv)\
**Post date:** [April 8, 2015, 12:16am UTC](https://discuss.elastic.co/t/parent-child-creation-in-two-different-indices/23142/1 "2015-04-08T00:16:03Z")

</div>

Hi All,

Is there any way to achieve creation of parent child mapping in two  
different indices. As mentioned in documentation  
[http://www.elastic.co/guide/en/elasticsearch/guide/master/parent-child-mapping.html](http://www.elastic.co/guide/en/elasticsearch/guide/master/parent-child-mapping.html)  
The documentation gives examples of same index like company

I tried to create two indices  
Index Type  
Company Branch  
Employee Employee

I have mentioned parent (branch) mapping in Employee type. There is no  
error during creation of mapping and building index.  
But elasticsearch is throwing error while searching using has\_child or  
has\_parent in queries.  
Is there any way to maintain two types of parent child relation in two  
different indices ?

--  
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/a402dec6-fd93-4a26-a9de-eb3217f13f6d%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a402dec6-fd93-4a26-a9de-eb3217f13f6d%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![vineeth\_mohan\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vineeth_mohan_2/32/747_2.png) [@vineeth\_mohan\_2](https://discuss.elastic.co/u/vineeth_mohan_2)\
**Post date:** [April 8, 2015, 4:30am UTC](https://discuss.elastic.co/t/parent-child-creation-in-two-different-indices/23142/2 "2015-04-08T04:30:47Z")

</div>

Hello Pavan ,

This is not possible.  
The parent and child need to be on the same index and same shard.  
To ensure this such a rule is imposed.

Thanks  
Vineeth Mohan,  
Elasticsearch consultant,  
[qbox.io](http://qbox.io) ( Elasticsearch service provider [http://qbox.io/](http://qbox.io/))

On Wed, Apr 8, 2015 at 5:46 AM, Pavan Kumar [pavan.bnv@gmail.com](mailto:pavan.bnv@gmail.com) wrote:

> Hi All,
> 
> Is there any way to achieve creation of parent child mapping in two  
> different indices. As mentioned in documentation
> 
> [Parent-Child Mapping | Elasticsearch: The Definitive Guide [master] | Elastic](http://www.elastic.co/guide/en/elasticsearch/guide/master/parent-child-mapping.html)
> 
> The documentation gives examples of same index like company
> 
> I tried to create two indices  
> Index Type  
> Company Branch  
> Employee Employee
> 
> I have mentioned parent (branch) mapping in Employee type. There is no  
> error during creation of mapping and building index.  
> But elasticsearch is throwing error while searching using has\_child or  
> has\_parent in queries.  
> Is there any way to maintain two types of parent child relation in two  
> different indices ?
> 
> --  
> 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/a402dec6-fd93-4a26-a9de-eb3217f13f6d%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a402dec6-fd93-4a26-a9de-eb3217f13f6d%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/a402dec6-fd93-4a26-a9de-eb3217f13f6d%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/a402dec6-fd93-4a26-a9de-eb3217f13f6d%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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/CAGdPd5mn0%3DUskwpY2CDMKtRs9xp77JzwC8-KZO5ZM0woa%3Dmkaw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5mn0%3DUskwpY2CDMKtRs9xp77JzwC8-KZO5ZM0woa%3Dmkaw%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 12:21am UTC](https://discuss.elastic.co/t/parent-child-creation-in-two-different-indices/23142/3 "2017-07-06T00:21:00Z")

</div>


