# Elasticsearch possible same \_id for parent-child

**URL:** <https://discuss.elastic.co/t/elasticsearch-possible-same-id-for-parent-child/262217>\
**Category:** Elasticsearch\
**Created:** [January 26, 2021, 10:07am UTC](https://discuss.elastic.co/t/elasticsearch-possible-same-id-for-parent-child/262217 "2021-01-26T10:07:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![J\_Kit](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/j_kit/32/77810_2.png) [@J\_Kit](https://discuss.elastic.co/u/J_Kit)\
**Post date:** [January 26, 2021, 10:07am UTC](https://discuss.elastic.co/t/elasticsearch-possible-same-id-for-parent-child/262217/1 "2021-01-26T10:07:13Z")

</div>

Hi

As I designing the elastic search for parent-child document type, I encounter this situation where my  
the parent and Child database table is different.

And when I combine both into the parent child, the will be possible id conflict  
Example

Parent \_id = 1 , routing = 1  
Child \_id= 1, routing=1

because both coming from different DB.

This will cause not able to update properly the child or parent only because the ID is the same.  
Would like to seek advice on how you tackle this scenario from your experience

Currently, my option is to set the child's id with the prefix.  
Example,

Parent \_id = 1, routing = 1  
Child \_id= c\_1, routing = 1

Do this work or a better solution for this?

---

<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:** [January 26, 2021, 9:38pm UTC](https://discuss.elastic.co/t/elasticsearch-possible-same-id-for-parent-child/262217/2 "2021-01-26T21:38:00Z")

</div>

I haven't seen what I would call a proper solution to this, for what it's worth. I think your approach is a good one.

---

<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:** [February 23, 2021, 9:38pm UTC](https://discuss.elastic.co/t/elasticsearch-possible-same-id-for-parent-child/262217/3 "2021-02-23T21:38:22Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
