# Sort Order Inconsistent

**URL:** <https://discuss.elastic.co/t/sort-order-inconsistent/156922>\
**Category:** Elasticsearch\
**Created:** [November 15, 2018, 5:57pm UTC](https://discuss.elastic.co/t/sort-order-inconsistent/156922 "2018-11-15T17:57:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sshaw](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sshaw/32/37643_2.png) [@sshaw](https://discuss.elastic.co/u/sshaw)\
**Post date:** [November 15, 2018, 5:57pm UTC](https://discuss.elastic.co/t/sort-order-inconsistent/156922/1 "2018-11-15T17:57:07Z")

</div>

Elasticsearch is running in a cluster with multiple shards. Two are primary, the rest are not. Using version 5.5.2.

I have several records with the same address but different document id. When I sort by address the order of the items within the same address varies. I assumed this is because the secondary ordering criteria is the document order.

When I run the search using the preference of `_primary`, the order is consistent. When I run the search using a preference of `_replica`, the sort is not consistent.

Is this expected behavior for primary and replica? Why does the order differ on replica?

---

<div class="post-metadata">

**Author:** ![sshaw](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sshaw/32/37643_2.png) [@sshaw](https://discuss.elastic.co/u/sshaw)\
**Post date:** [November 16, 2018, 6:14pm UTC](https://discuss.elastic.co/t/sort-order-inconsistent/156922/2 "2018-11-16T18:14:53Z")

</div>

Ok, found relevant info in The Definitive Guide. Says it's for v2.2, but that's fine. See [Bouncing Results](https://www.elastic.co/guide/en/elasticsearch/guide/current/_search_options.html).

---

<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:** [December 14, 2018, 6:15pm UTC](https://discuss.elastic.co/t/sort-order-inconsistent/156922/3 "2018-12-14T18:15:04Z")

</div>

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