# Elastic search \_id uuid format

**URL:** <https://discuss.elastic.co/t/elastic-search--id-uuid-format/28801>\
**Category:** Elasticsearch\
**Created:** [September 7, 2015, 11:58pm UTC](https://discuss.elastic.co/t/elastic-search--id-uuid-format/28801 "2015-09-07T23:58:32Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![eprst](https://avatars.discourse-cdn.com/v4/letter/e/a6a055/32.png) [@eprst](https://discuss.elastic.co/u/eprst)\
**Post date:** [September 7, 2015, 11:58pm UTC](https://discuss.elastic.co/t/elastic-search--id-uuid-format/28801/1 "2015-09-07T23:58:32Z")

</div>

I can add document with id which is formated like xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. but when i create new document without setting up id it will be like xx-xxxxxxxxxxxxxxxxx. how can i configure elasticsearch to create new id with the same format.

---

<div class="post-metadata">

**Author:** ![shanec](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shanec/32/4004_2.png) [@shanec](https://discuss.elastic.co/u/shanec)\
**Post date:** [September 8, 2015, 8:03pm UTC](https://discuss.elastic.co/t/elastic-search--id-uuid-format/28801/2 "2015-09-08T20:03:10Z")

</div>

When you add a document to ES using a POST, it automatically generates the ID to be a 22-character URL-safe UUID, per [the documentation](https://www.elastic.co/guide/en/elasticsearch/guide/current/index-doc.html). There is no internal way to generate IDs via some other template, for example, so if you need to do that, you need to add the document with a PUT and specify the ID at that time in whatever you're using to index the document

---

<div class="post-metadata">

**Author:** ![eprst](https://avatars.discourse-cdn.com/v4/letter/e/a6a055/32.png) [@eprst](https://discuss.elastic.co/u/eprst)\
**Post date:** [September 8, 2015, 9:23pm UTC](https://discuss.elastic.co/t/elastic-search--id-uuid-format/28801/3 "2015-09-08T21:23:54Z")

</div>

Ok but how can i generate unique uuid (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx) for es to put it ?

---

<div class="post-metadata">

**Author:** ![shanec](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shanec/32/4004_2.png) [@shanec](https://discuss.elastic.co/u/shanec)\
**Post date:** [September 8, 2015, 9:32pm UTC](https://discuss.elastic.co/t/elastic-search--id-uuid-format/28801/4 "2015-09-08T21:32:17Z")

</div>

The 8-4-4-4-12 format you mention is often associated with [RFC 4122](https://www.ietf.org/rfc/rfc4122.txt). You're probably best to look to use whatever UUID generation library/class/function is available for whatever programming language you're using to push data into ES. You can usually search for "RFC 4122 " or "UUID " on the Internet to find appropriate libraries.

---

<div class="post-metadata">

**Author:** ![eprst](https://avatars.discourse-cdn.com/v4/letter/e/a6a055/32.png) [@eprst](https://discuss.elastic.co/u/eprst)\
**Post date:** [September 9, 2015, 7:03am UTC](https://discuss.elastic.co/t/elastic-search--id-uuid-format/28801/5 "2015-09-09T07:03:32Z")

</div>

Thank you. i just thought there is some sort of uuid generator in es

---

<div class="post-metadata">

**Author:** ![eprst](https://avatars.discourse-cdn.com/v4/letter/e/a6a055/32.png) [@eprst](https://discuss.elastic.co/u/eprst)\
**Post date:** [March 23, 2016, 2:55pm UTC](https://discuss.elastic.co/t/elastic-search--id-uuid-format/28801/6 "2016-03-23T14:55:26Z")

</div>

I want to write Elastic plugin which will check if there is an id field in indexing document and if no then it will generate id of the type i needed. HOw to do it? i can't regsiter mapper for \_id field.

---

<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 5, 2017, 11:05pm UTC](https://discuss.elastic.co/t/elastic-search--id-uuid-format/28801/7 "2017-07-05T23:05:50Z")

</div>


