# Question about \_reindex behavior when using custom \_id values

**URL:** <https://forum.opensearch.org/t/question-about-reindex-behavior-when-using-custom-id-values/27907>\
**Category:** OpenSearch\
**Tags:** index-management\
**Created:** [March 6, 2026, 2:21pm UTC](https://forum.opensearch.org/t/question-about-reindex-behavior-when-using-custom-id-values/27907 "2026-03-06T14:21:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sylex-io](https://avatars.discourse-cdn.com/v4/letter/s/4491bb/32.png) [@Sylex-io](https://forum.opensearch.org/u/Sylex-io)\
**Post date:** [March 6, 2026, 2:21pm UTC](https://forum.opensearch.org/t/question-about-reindex-behavior-when-using-custom-id-values/27907/1 "2026-03-06T14:21:32Z")

</div>

**Versions** (relevant - OpenSearch/Dashboard/Server OS/Browser): OpenSearch-1.3.6

**Describe the issue** :

Hi everyone,

In our project, we use custom `_id` values based on a numeric sequence (1, 2, 3, …) instead of the automatically generated IDs.

I have a question regarding the behavior of the `_reindex` API:

- If a document with a given `_id` already exists in the target index, and we run a `_reindex` operation from another index that contains the same `_id`, can you confirm that the existing document will be overwritten?

- If we rely on automatically generated IDs instead, how does OpenSearch ensure that IDs won’t collide during a reindex into an index that already contains data?

- More generally, what is the recommended way to guarantee that reindexing into an index with existing documents won’t accidentally overwrite a document that happens to share the same `_id` as one coming from the source index?

Thanks in advance for your help!

---

<div class="post-metadata">

**Author:** ![Anthony](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/anthony/32/9939_2.png) [@Anthony](https://forum.opensearch.org/u/Anthony)\
**Post date:** [March 6, 2026, 4:53pm UTC](https://forum.opensearch.org/t/question-about-reindex-behavior-when-using-custom-id-values/27907/2 "2026-03-06T16:53:53Z")

</div>

@Sylex-io By default reindex uses `index` operation, therefore it will overwrite any existing documents is the IDs collide.

You can use `"op_type": "create"` in the reindex operation to not override the existing values.

But the question is what do you want to happen to the collision? The reindex operation returns only the number of collisions, but not the IDs themselves.

Generally it is recommended to let OpenSearch determine the IDs for performance reason and better shard distribution.

Hope this helps
