# Search results order varies each time in Elasticsearch

**URL:** https://discuss.elastic.co/t/search-results-order-varies-each-time-in-elasticsearch/63755
**Category:** Elasticsearch
**Created:** [October 24, 2016, 1:33pm UTC](https://discuss.elastic.co/t/search-results-order-varies-each-time-in-elasticsearch/63755 "2016-10-24T13:33:52Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![banu](https://avatars.discourse-cdn.com/v4/letter/b/2acd7d/32.png) [@banu](https://discuss.elastic.co/u/banu)
#### Post date: [October 24, 2016, 1:33pm UTC](https://discuss.elastic.co/t/search-results-order-varies-each-time-in-elasticsearch/63755/1 "2016-10-24T13:33:52Z")

</div>

We have 200k records. When running search query for the first time with size: 500 I am getting results in doc-1, doc-2, doc-3. But when I run the same search query for the second time I am getting the order changed to doc-2, doc-1, etc ... why the search result order varies each time when we run the same query ?

---

<div class="post-metadata">

### Author: ![mainec](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mainec/32/5557_2.png) [@mainec](https://discuss.elastic.co/u/mainec)
#### Post date: [October 25, 2016, 12:15pm UTC](https://discuss.elastic.co/t/search-results-order-varies-each-time-in-elasticsearch/63755/2 "2016-10-25T12:15:22Z")

</div>

Without knowing the mapping, query and content of your index it's rather hard to guess at what's going on there.

Did you try using the explain API:

[https://www.elastic.co/guide/en/elasticsearch/reference/current/search-explain.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-explain.html)

To figure out why your documents are sorted the way they are sorted?

Other than that, maybe you can come up with a minimal curl reproduction of your problem that doesn't involve first indexing 200k documents so others can have a look...

Hope this helps,  
Isabel

---

<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: [October 26, 2016, 9:52am UTC](https://discuss.elastic.co/t/search-results-order-varies-each-time-in-elasticsearch/63755/3 "2016-10-26T09:52:54Z")

</div>

Response order is not guaranteed in searches as far as I understand. It returns results in terms of scoring.

---

<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 5, 2017, 10:09pm UTC](https://discuss.elastic.co/t/search-results-order-varies-each-time-in-elasticsearch/63755/4 "2017-07-05T22:09:36Z")

</div>


