# Reindex order

**URL:** <https://discuss.elastic.co/t/reindex-order/273114>\
**Category:** Elasticsearch\
**Created:** [May 16, 2021, 8:31pm UTC](https://discuss.elastic.co/t/reindex-order/273114 "2021-05-16T20:31:54Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![alexs1](https://avatars.discourse-cdn.com/v4/letter/a/47e85d/32.png) [@alexs1](https://discuss.elastic.co/u/alexs1)\
**Post date:** [May 16, 2021, 8:31pm UTC](https://discuss.elastic.co/t/reindex-order/273114/1 "2021-05-16T20:31:54Z")

</div>

Hello,

Does the reindex save the original order of the documents?  
Does the answer the same when using slice?

Thank you!

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [May 16, 2021, 8:53pm UTC](https://discuss.elastic.co/t/reindex-order/273114/2 "2021-05-16T20:53:16Z")

</div>

You'd have to use a sort if you care about order. If you slice the results are sliced semi-randomly and then sorted and then indexed.

If you don't sort reindex will come back in a fairly undefined order. It uses `_doc` order, which is just the fastest order it can manage. So the order is based on how things happen to be one disk. It might not have anything to Do with the order you sent them in.

---

<div class="post-metadata">

**Author:** ![alexs1](https://avatars.discourse-cdn.com/v4/letter/a/47e85d/32.png) [@alexs1](https://discuss.elastic.co/u/alexs1)\
**Post date:** [May 16, 2021, 9:10pm UTC](https://discuss.elastic.co/t/reindex-order/273114/3 "2021-05-16T21:10:00Z")

</div>

thank you @nik9000

the docs says its deprecated, so I wonder if it matters for performance of time series queries- to keep it's original ingest order

also slice and sort will not work together right?

thanks a lot.

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [May 17, 2021, 12:36am UTC](https://discuss.elastic.co/t/reindex-order/273114/4 "2021-05-17T00:36:34Z")

</div>

We don't keep docs in the order you sent them. Well, they can get.pretty jumbled and we don't prevent that.

It does help in time series searches to have the index in sorted order - you can set the index to sort on any field you like. That will slow down writes some and should speed up some queries. It's not on by default.

---

<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:** [June 14, 2021, 12:37am UTC](https://discuss.elastic.co/t/reindex-order/273114/5 "2021-06-14T00:37:33Z")

</div>

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