# Implications of using serial ids for documents

**URL:** <https://discuss.elastic.co/t/implications-of-using-serial-ids-for-documents/241355>\
**Category:** Elasticsearch\
**Created:** [July 15, 2020, 7:50pm UTC](https://discuss.elastic.co/t/implications-of-using-serial-ids-for-documents/241355 "2020-07-15T19:50:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![terell](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/terell/32/69755_2.png) [@terell](https://discuss.elastic.co/u/terell)\
**Post date:** [July 15, 2020, 7:50pm UTC](https://discuss.elastic.co/t/implications-of-using-serial-ids-for-documents/241355/1 "2020-07-15T19:50:24Z")

</div>

I'm planning on linking documents I write to ES to records in my relational database by simply taking the record id and writing it to the document id. This means the IDs for my documents will be serial (ie. 1,2,3,4,5) instead of random.

Any idea if this could cause long term performance issues? Perhaps having non random but serial document ids will cause documents to not be randomly distributed through the storage engine making reads more expensive.

---

<div class="post-metadata">

**Author:** ![Vinayak\_Sapre](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vinayak_sapre/32/45939_2.png) [@Vinayak\_Sapre](https://discuss.elastic.co/u/Vinayak_Sapre)\
**Post date:** [July 15, 2020, 8:28pm UTC](https://discuss.elastic.co/t/implications-of-using-serial-ids-for-documents/241355/2 "2020-07-15T20:28:35Z")

</div>

@terell  
If ids are serial I think distribution should not be an issue. But providing \_id (serial or not) will degrade ingestion speed as number of documents in the index grow.

---

<div class="post-metadata">

**Author:** ![terell](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/terell/32/69755_2.png) [@terell](https://discuss.elastic.co/u/terell)\
**Post date:** [July 16, 2020, 5:07am UTC](https://discuss.elastic.co/t/implications-of-using-serial-ids-for-documents/241355/3 "2020-07-16T05:07:39Z")

</div>

Awesome. I'm guessing that the `id` field does not override the underlying `_id` field?

---

<div class="post-metadata">

**Author:** ![Vinayak\_Sapre](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vinayak_sapre/32/45939_2.png) [@Vinayak\_Sapre](https://discuss.elastic.co/u/Vinayak_Sapre)\
**Post date:** [July 16, 2020, 7:27pm UTC](https://discuss.elastic.co/t/implications-of-using-serial-ids-for-documents/241355/4 "2020-07-16T19:27:02Z")

</div>

@terell

> [@terell](#):
>
> I'm planning on linking documents I write to ES to records in my relational database by simply taking the record id and writing it to the document id.

A meta-field \_id is the document id. ES will ensure it's unique in an index. If you ingest two documents with same \_id, the later one will overwrite previous one.

A field with a name "id" is an ordinary field. ES will allow any number of duplicates.

---

<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:** [August 13, 2020, 7:27pm UTC](https://discuss.elastic.co/t/implications-of-using-serial-ids-for-documents/241355/5 "2020-08-13T19:27:21Z")

</div>

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