# Inconsistent results

**URL:** https://discuss.elastic.co/t/inconsistent-results/6466
**Category:** Elasticsearch
**Created:** [January 23, 2012, 10:50am UTC](https://discuss.elastic.co/t/inconsistent-results/6466 "2012-01-23T10:50:45Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![anghelutar](https://avatars.discourse-cdn.com/v4/letter/a/34f0e0/32.png) [@anghelutar](https://discuss.elastic.co/u/anghelutar)
#### Post date: [January 23, 2012, 10:50am UTC](https://discuss.elastic.co/t/inconsistent-results/6466/1 "2012-01-23T10:50:45Z")

</div>

Hi all,

I have a cluster with 4 nodes and I am running a very simple query:

curl -XPOST '[http://85.88.36.61:9200/ng0010185/\_search](http://85.88.36.61:9200/ng0010185/_search)?  
search\_type=dfs\_query\_then\_fetch' -d '  
{  
"size": 10,  
"query": {  
"match\_all" : {  
}  
}  
}  
'

Each time when I run the query I get different results in terms of the  
documents returned. The number of hits is the same. In fact there seem  
to be 2 types of results, obtained at every other run.

Why do I get this behaviour? Is there any way to make the search  
consistent?

Thanks,  
roxana

---

<div class="post-metadata">

### Author: ![Nick\_Hoffman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nick_hoffman/32/1872_2.png) [@Nick\_Hoffman](https://discuss.elastic.co/u/Nick_Hoffman)
#### Post date: [January 23, 2012, 6:52pm UTC](https://discuss.elastic.co/t/inconsistent-results/6466/2 "2012-01-23T18:52:27Z")

</div>

Hi there, Roxana. Try enabling the "explain" option to determine why you're  
getting inconsistent results.

[http://www.elasticsearch.org/guide/reference/api/search/explain.html](http://www.elasticsearch.org/guide/reference/api/search/explain.html)

Cheers,  
Nick

---

<div class="post-metadata">

### Author: ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)
#### Post date: [January 23, 2012, 7:27pm UTC](https://discuss.elastic.co/t/inconsistent-results/6466/3 "2012-01-23T19:27:08Z")

</div>

match\_all has not guarantees for ordering (even when you do dfs phase). The  
reason you see two sets of results is that it hits one set of shards, and  
then another (within a shard, match\_all will have the same order, but not  
between a shard and its replica).

On Mon, Jan 23, 2012 at 12:50 PM, anghelutar [anghelutar@gmail.com](mailto:anghelutar@gmail.com) wrote:

> Hi all,
> 
> I have a cluster with 4 nodes and I am running a very simple query:
> 
> curl -XPOST '[http://85.88.36.61:9200/ng0010185/\_search](http://85.88.36.61:9200/ng0010185/_search)?  
> search\_type=dfs\_query\_then\_fetch' -d '  
> {  
> "size": 10,  
> "query": {  
> "match\_all" : {  
> }  
> }  
> }  
> '
> 
> Each time when I run the query I get different results in terms of the  
> documents returned. The number of hits is the same. In fact there seem  
> to be 2 types of results, obtained at every other run.
> 
> Why do I get this behaviour? Is there any way to make the search  
> consistent?
> 
> Thanks,  
> roxana

---

<div class="post-metadata">

### Author: ![Mark\_Waddle](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_waddle/32/2608_2.png) [@Mark\_Waddle](https://discuss.elastic.co/u/Mark_Waddle)
#### Post date: [January 24, 2012, 3:32am UTC](https://discuss.elastic.co/t/inconsistent-results/6466/4 "2012-01-24T03:32:15Z")

</div>

To ensure consistency you need to sort on a field other than score, as  
score will be 1 for all documents.

Mark

---

<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 6, 2017, 3:41am UTC](https://discuss.elastic.co/t/inconsistent-results/6466/5 "2017-07-06T03:41:45Z")

</div>


