# Auto generated auto-incremented document id in numeric form

**URL:** <https://discuss.elastic.co/t/auto-generated-auto-incremented-document-id-in-numeric-form/187245>\
**Category:** Elasticsearch\
**Created:** [June 25, 2019, 7:13am UTC](https://discuss.elastic.co/t/auto-generated-auto-incremented-document-id-in-numeric-form/187245 "2019-06-25T07:13:42Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Roobal\_Jindal](https://avatars.discourse-cdn.com/v4/letter/r/ecb155/32.png) [@Roobal\_Jindal](https://discuss.elastic.co/u/Roobal_Jindal)\
**Post date:** [June 25, 2019, 7:13am UTC](https://discuss.elastic.co/t/auto-generated-auto-incremented-document-id-in-numeric-form/187245/1 "2019-06-25T07:13:42Z")

</div>

How can I assign auto-incremented number id to my every new document? I don't want to have that auto generated long non-readable id from elastic search.

I want elastic search to handle/assign numeric values to my document id at time of index. I don't want to manually handle auto incremented ids at time of indexing, neither I want to use log stash. Is there a way?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [June 25, 2019, 8:08am UTC](https://discuss.elastic.co/t/auto-generated-auto-incremented-document-id-in-numeric-form/187245/2 "2019-06-25T08:08:03Z")

</div>

I don't think there is anything and actually there won't be probably anything that will be fast if you have to do a lookup for every single document you want to index.

Is there any reason you don't want to autogenerated id?

---

<div class="post-metadata">

**Author:** ![Roobal\_Jindal](https://avatars.discourse-cdn.com/v4/letter/r/ecb155/32.png) [@Roobal\_Jindal](https://discuss.elastic.co/u/Roobal_Jindal)\
**Post date:** [June 25, 2019, 9:26am UTC](https://discuss.elastic.co/t/auto-generated-auto-incremented-document-id-in-numeric-form/187245/3 "2019-06-25T09:26:17Z")

</div>

Reason is that its hard for support team to ask dev team delete particular document or range of documents based on id.  
Document id is not readable, one can simply ask to delete documents from id \> 20 and \<40 but here it is not the case.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [June 25, 2019, 10:33am UTC](https://discuss.elastic.co/t/auto-generated-auto-incremented-document-id-in-numeric-form/187245/4 "2019-06-25T10:33:10Z")

</div>

I don't know your use case so it's hard to give advices but if you have let say customer data where the document contains the document id and you have a timestamp (automatically generated with a painless script processor or better by your application), then it's easy to delete by query documents between 2 dates for a given customer id.

---

<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 23, 2019, 10:33am UTC](https://discuss.elastic.co/t/auto-generated-auto-incremented-document-id-in-numeric-form/187245/5 "2019-07-23T10:33:19Z")

</div>

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