# How to get same ordered data from elasticsearch as it was indexed

**URL:** <https://discuss.elastic.co/t/how-to-get-same-ordered-data-from-elasticsearch-as-it-was-indexed/277843>\
**Category:** Elasticsearch\
**Created:** [July 5, 2021, 2:31pm UTC](https://discuss.elastic.co/t/how-to-get-same-ordered-data-from-elasticsearch-as-it-was-indexed/277843 "2021-07-05T14:31:25Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![user11](https://avatars.discourse-cdn.com/v4/letter/u/dfb087/32.png) [@user11](https://discuss.elastic.co/u/user11)\
**Post date:** [July 5, 2021, 2:31pm UTC](https://discuss.elastic.co/t/how-to-get-same-ordered-data-from-elasticsearch-as-it-was-indexed/277843/1 "2021-07-05T14:31:25Z")

</div>

I would like to retrieve documents from elasticsearch in the same order as it was indexed. Timestamp won't work because there will be collisions.  
Sequence number won't work because it is unique only per shard.  
Does elasticsearch provide such a feature out of the box?

---

<div class="post-metadata">

**Author:** ![ritchierich](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ritchierich/32/4329_2.png) [@ritchierich](https://discuss.elastic.co/u/ritchierich)\
**Post date:** [July 5, 2021, 2:41pm UTC](https://discuss.elastic.co/t/how-to-get-same-ordered-data-from-elasticsearch-as-it-was-indexed/277843/2 "2021-07-05T14:41:50Z")

</div>

You could create your own indexed timestamp using an [ingest pipeline](https://www.elastic.co/guide/en/elasticsearch/reference/master/ingest.html).

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [July 5, 2021, 10:41pm UTC](https://discuss.elastic.co/t/how-to-get-same-ordered-data-from-elasticsearch-as-it-was-indexed/277843/3 "2021-07-05T22:41:27Z")

</div>

Welcome to our community! 😃

There's nothing in Elasticsearch natively to do this, you would need to create and manage your own sequence ID.

---

<div class="post-metadata">

**Author:** ![user11](https://avatars.discourse-cdn.com/v4/letter/u/dfb087/32.png) [@user11](https://discuss.elastic.co/u/user11)\
**Post date:** [July 6, 2021, 7:01am UTC](https://discuss.elastic.co/t/how-to-get-same-ordered-data-from-elasticsearch-as-it-was-indexed/277843/4 "2021-07-06T07:01:47Z")

</div>

Thank you warkolm, That is probably the solution I am going with 😃

---

<div class="post-metadata">

**Author:** ![user11](https://avatars.discourse-cdn.com/v4/letter/u/dfb087/32.png) [@user11](https://discuss.elastic.co/u/user11)\
**Post date:** [July 6, 2021, 7:02am UTC](https://discuss.elastic.co/t/how-to-get-same-ordered-data-from-elasticsearch-as-it-was-indexed/277843/5 "2021-07-06T07:02:37Z")

</div>

Thank you @ritchierich, I wasn't aware about ingest pipelines

---

<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 3, 2021, 7:03am UTC](https://discuss.elastic.co/t/how-to-get-same-ordered-data-from-elasticsearch-as-it-was-indexed/277843/6 "2021-08-03T07:03:26Z")

</div>

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