# Can we give parent/child relation ship between different indexes

**URL:** <https://discuss.elastic.co/t/can-we-give-parent-child-relation-ship-between-different-indexes/25872>\
**Category:** Elasticsearch\
**Created:** [July 20, 2015, 6:25am UTC](https://discuss.elastic.co/t/can-we-give-parent-child-relation-ship-between-different-indexes/25872 "2015-07-20T06:25:17Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![anusha6](https://avatars.discourse-cdn.com/v4/letter/a/a5b964/32.png) [@anusha6](https://discuss.elastic.co/u/anusha6)\
**Post date:** [July 20, 2015, 6:25am UTC](https://discuss.elastic.co/t/can-we-give-parent-child-relation-ship-between-different-indexes/25872/1 "2015-07-20T06:25:17Z")

</div>

Hi,  
I would like to give parent/ child relationship between three different indexes,  
where indexes are index1, index2, index3 with different types in those indexes..  
May I know is it possible???

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [July 20, 2015, 6:32am UTC](https://discuss.elastic.co/t/can-we-give-parent-child-relation-ship-between-different-indexes/25872/2 "2015-07-20T06:32:42Z")

</div>

No you cannot.

Needs to be done in the same index, and specifically, in the same shard.

---

<div class="post-metadata">

**Author:** ![anusha6](https://avatars.discourse-cdn.com/v4/letter/a/a5b964/32.png) [@anusha6](https://discuss.elastic.co/u/anusha6)\
**Post date:** [July 20, 2015, 6:36am UTC](https://discuss.elastic.co/t/can-we-give-parent-child-relation-ship-between-different-indexes/25872/3 "2015-07-20T06:36:56Z")

</div>

How to know that my data is in a particular shard? and how can I keep in the same shard???????????

where my settings having following information regarding shards as shown:

"number\_of\_shards": "5",  
"version": {  
"created": "1050299"  
}

---

<div class="post-metadata">

**Author:** ![PatrickKik](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/patrickkik/32/619_2.png) [@PatrickKik](https://discuss.elastic.co/u/PatrickKik)\
**Post date:** [July 20, 2015, 6:37am UTC](https://discuss.elastic.co/t/can-we-give-parent-child-relation-ship-between-different-indexes/25872/4 "2015-07-20T06:37:48Z")

</div>

Wanting to have parent/child relations between indexes is, I think, a smell of a bad data model. It looks to me you are storing different entities in different locations. Perhaps you should aggregate those entities together.

---

<div class="post-metadata">

**Author:** ![PatrickKik](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/patrickkik/32/619_2.png) [@PatrickKik](https://discuss.elastic.co/u/PatrickKik)\
**Post date:** [July 20, 2015, 6:39am UTC](https://discuss.elastic.co/t/can-we-give-parent-child-relation-ship-between-different-indexes/25872/5 "2015-07-20T06:39:02Z")

</div>

With regard to your routing question, see [https://www.elastic.co/guide/en/elasticsearch/guide/current/indexing-parent-child.html](https://www.elastic.co/guide/en/elasticsearch/guide/current/indexing-parent-child.html)

---

<div class="post-metadata">

**Author:** ![anusha6](https://avatars.discourse-cdn.com/v4/letter/a/a5b964/32.png) [@anusha6](https://discuss.elastic.co/u/anusha6)\
**Post date:** [July 20, 2015, 6:41am UTC](https://discuss.elastic.co/t/can-we-give-parent-child-relation-ship-between-different-indexes/25872/6 "2015-07-20T06:41:16Z")

</div>

Hi Patrick,  
Then what about the shards as Mark mentioned???? May I know what exactly the shards do???

---

<div class="post-metadata">

**Author:** ![anusha6](https://avatars.discourse-cdn.com/v4/letter/a/a5b964/32.png) [@anusha6](https://discuss.elastic.co/u/anusha6)\
**Post date:** [July 20, 2015, 6:45am UTC](https://discuss.elastic.co/t/can-we-give-parent-child-relation-ship-between-different-indexes/25872/7 "2015-07-20T06:45:30Z")

</div>

How can I maintain the data in the same shard and how to know that in which shard my parent data is stored..??????

---

<div class="post-metadata">

**Author:** ![anusha6](https://avatars.discourse-cdn.com/v4/letter/a/a5b964/32.png) [@anusha6](https://discuss.elastic.co/u/anusha6)\
**Post date:** [July 20, 2015, 6:59am UTC](https://discuss.elastic.co/t/can-we-give-parent-child-relation-ship-between-different-indexes/25872/8 "2015-07-20T06:59:39Z")

</div>

@warkolm and @PatrickKik Thanks for your reply, and I came to know what exactly the data need to be in same shard. This helps me to sort the problem.

Thank you..

---

<div class="post-metadata">

**Author:** ![anusha6](https://avatars.discourse-cdn.com/v4/letter/a/a5b964/32.png) [@anusha6](https://discuss.elastic.co/u/anusha6)\
**Post date:** [July 20, 2015, 7:21am UTC](https://discuss.elastic.co/t/can-we-give-parent-child-relation-ship-between-different-indexes/25872/9 "2015-07-20T07:21:52Z")

</div>

And can we have more than one parent in a child type???

---

<div class="post-metadata">

**Author:** ![PatrickKik](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/patrickkik/32/619_2.png) [@PatrickKik](https://discuss.elastic.co/u/PatrickKik)\
**Post date:** [July 20, 2015, 7:27am UTC](https://discuss.elastic.co/t/can-we-give-parent-child-relation-ship-between-different-indexes/25872/10 "2015-07-20T07:27:16Z")

</div>

You can have one parent per child. It saves you the horrors of conflicting multiple inheritance.

---

<div class="post-metadata">

**Author:** ![anusha6](https://avatars.discourse-cdn.com/v4/letter/a/a5b964/32.png) [@anusha6](https://discuss.elastic.co/u/anusha6)\
**Post date:** [July 20, 2015, 9:01am UTC](https://discuss.elastic.co/t/can-we-give-parent-child-relation-ship-between-different-indexes/25872/11 "2015-07-20T09:01:20Z")

</div>

Okay Thank you Patrick..

---

<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:00am UTC](https://discuss.elastic.co/t/can-we-give-parent-child-relation-ship-between-different-indexes/25872/12 "2017-07-06T00:00:24Z")

</div>


