# Possible to create duplicate child ids in parent/child?

**URL:** <https://discuss.elastic.co/t/possible-to-create-duplicate-child-ids-in-parent-child/84746>\
**Category:** Elasticsearch\
**Created:** [May 5, 2017, 2:46pm UTC](https://discuss.elastic.co/t/possible-to-create-duplicate-child-ids-in-parent-child/84746 "2017-05-05T14:46:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ElStefan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/elstefan/32/17963_2.png) [@ElStefan](https://discuss.elastic.co/u/ElStefan)\
**Post date:** [May 5, 2017, 2:46pm UTC](https://discuss.elastic.co/t/possible-to-create-duplicate-child-ids-in-parent-child/84746/1 "2017-05-05T14:46:53Z")

</div>

Hi,

I'm trying to create parent documents with multiple children.  
For example one parent has the id "1" and has a child with the id "child\_1".  
And then there is another parent document with the id "2" and has also a child with the id "child\_1", but both children are different documents of the same type.

While I was testing this (simple elasticsearch service on a windows machine, single node, v2.3.0), I discovered something strange. When I created a test index with 5 shards and 1 replica, creating the documents is working fine. But when I change the number of shards to 1, 2 or 4, it fails with the error message, telling me the document "child\_1" already exists. I've tried any number from 1 to 17.. and luckily the wanted value is 4 🙂

Now I don't know if this is expected behaviour or a bug?  
Should I give every child a unique id like "child1\_1" and "child1\_2" to avoid this? It would be easier for me to use the same ids on the children, because I need to provide the parent's id in a request anyway..

Examples can be provided if needed for further investigation.

---

<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:** [June 2, 2017, 2:47pm UTC](https://discuss.elastic.co/t/possible-to-create-duplicate-child-ids-in-parent-child/84746/2 "2017-06-02T14:47:09Z")

</div>

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