# Reason for creating a custom document\_id?

**URL:** <https://discuss.elastic.co/t/reason-for-creating-a-custom-document-id/218368>\
**Category:** Logstash\
**Created:** [February 7, 2020, 2:54pm UTC](https://discuss.elastic.co/t/reason-for-creating-a-custom-document-id/218368 "2020-02-07T14:54:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![\_finack](https://avatars.discourse-cdn.com/v4/letter/_/e68b1a/32.png) [@\_finack](https://discuss.elastic.co/u/_finack)\
**Post date:** [February 7, 2020, 2:54pm UTC](https://discuss.elastic.co/t/reason-for-creating-a-custom-document-id/218368/1 "2020-02-07T14:54:00Z")

</div>

I've seen various Logstash filter plugins customizing the document\_id field in pipeline filters (e.g. the HELK project). I'm trying to make sense of the reason for doing this. Doesn't a unique document\_id get applied automatically?

I'm thinking of the document\_id as akin to a unique key in a RDBMS table just as a way to identify an individal record. Perhaps I just haven't discovered what the document\_id is useful for beyond allowing the system to refer to the particular document.

New Elastic Stack user here. I apologize for such a beginner question.

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [February 7, 2020, 3:46pm UTC](https://discuss.elastic.co/t/reason-for-creating-a-custom-document-id/218368/2 "2020-02-07T15:46:41Z")

</div>

If you ingest the same set of documents more than once (because they have been updated) you want to overwrite the target document, so it has to have the same document\_id. If you do not set it then a new unique id will be applied, resulting in a second copy of the document.

---

<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 6, 2020, 3:46pm UTC](https://discuss.elastic.co/t/reason-for-creating-a-custom-document-id/218368/3 "2020-03-06T15:46:44Z")

</div>

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