# Exist any limitations on how a \_id document field could be

**URL:** <https://discuss.elastic.co/t/exist-any-limitations-on-how-a-id-document-field-could-be/296344>\
**Category:** Elasticsearch\
**Created:** [February 4, 2022, 9:11pm UTC](https://discuss.elastic.co/t/exist-any-limitations-on-how-a-id-document-field-could-be/296344 "2022-02-04T21:11:54Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Silver137](https://avatars.discourse-cdn.com/v4/letter/s/839c29/32.png) [@Silver137](https://discuss.elastic.co/u/Silver137)\
**Post date:** [February 4, 2022, 9:11pm UTC](https://discuss.elastic.co/t/exist-any-limitations-on-how-a-id-document-field-could-be/296344/1 "2022-02-04T21:11:54Z")

</div>

I always notice that the \_id field of any index created is normaly a uuid, hash value or a simple numeric sucession depending of the use case.

My question is if there are any limitation in the form and aspect when choosing a custom \_id beyond the be unique and avoid duplicates for a particular use case, for example related to throughput, or routing to shards.

---

<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:** [February 6, 2022, 9:42pm UTC](https://discuss.elastic.co/t/exist-any-limitations-on-how-a-id-document-field-could-be/296344/2 "2022-02-06T21:42:13Z")

</div>

[\_id field | Elasticsearch Guide [7.17] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/7.17/mapping-id-field.html) goes into limitations on there, but it's really just;

> \_id is limited to 512 bytes in size and larger values will be rejected.

---

<div class="post-metadata">

**Author:** ![Silver137](https://avatars.discourse-cdn.com/v4/letter/s/839c29/32.png) [@Silver137](https://discuss.elastic.co/u/Silver137)\
**Post date:** [February 7, 2022, 2:57pm UTC](https://discuss.elastic.co/t/exist-any-limitations-on-how-a-id-document-field-could-be/296344/4 "2022-02-07T14:57:14Z")

</div>

The content not matters in routing then?  
As long as the id is unique the index will work correctly?

---

<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:** [February 7, 2022, 9:15pm UTC](https://discuss.elastic.co/t/exist-any-limitations-on-how-a-id-document-field-could-be/296344/5 "2022-02-07T21:15:18Z")

</div>

I dunno if they support all unicode, but otherwise, yes.

---

<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:** [March 7, 2022, 9:15pm UTC](https://discuss.elastic.co/t/exist-any-limitations-on-how-a-id-document-field-could-be/296344/6 "2022-03-07T21:15:48Z")

</div>

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