# Are documents with similar ids stored together?

**URL:** <https://discuss.elastic.co/t/are-documents-with-similar-ids-stored-together/187259>\
**Category:** Elasticsearch\
**Created:** [June 25, 2019, 8:13am UTC](https://discuss.elastic.co/t/are-documents-with-similar-ids-stored-together/187259 "2019-06-25T08:13:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paul-Matthieu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/paul-matthieu/32/47961_2.png) [@Paul-Matthieu](https://discuss.elastic.co/u/Paul-Matthieu)\
**Post date:** [June 25, 2019, 8:13am UTC](https://discuss.elastic.co/t/are-documents-with-similar-ids-stored-together/187259/1 "2019-06-25T08:13:59Z")

</div>

Hi

Does the id (the _\_id_ field) of a document have any consequence on where and how it is stored and compressed, ie will 2 documents with "close" ids be stored together or not ?  
In other words, I'm trying to figure out if computing an id based on certain fields for a given document before indexing will let me query these documents faster later or not

Thank you for your help !

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [June 25, 2019, 8:24am UTC](https://discuss.elastic.co/t/are-documents-with-similar-ids-stored-together/187259/2 "2019-06-25T08:24:39Z")

</div>

No. Documents are assigned to shards based on a hash if the id so that is not the case.

---

<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, 8:24am UTC](https://discuss.elastic.co/t/are-documents-with-similar-ids-stored-together/187259/3 "2019-07-23T08:24:44Z")

</div>

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