# Different results, with the same query (local, single node). Strange!

**URL:** <https://discuss.elastic.co/t/different-results-with-the-same-query-local-single-node-strange/44919>\
**Category:** Elasticsearch\
**Created:** [March 20, 2016, 3:57am UTC](https://discuss.elastic.co/t/different-results-with-the-same-query-local-single-node-strange/44919 "2016-03-20T03:57:51Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yongyao\_Jiang](https://avatars.discourse-cdn.com/v4/letter/y/c4cdca/32.png) [@Yongyao\_Jiang](https://discuss.elastic.co/u/Yongyao_Jiang)\
**Post date:** [March 20, 2016, 3:57am UTC](https://discuss.elastic.co/t/different-results-with-the-same-query-local-single-node-strange/44919/1 "2016-03-20T03:57:51Z")

</div>

Hey guys,

Just came across this strange thing. What I have is the simplest case, nothing fancy: local, single node, 1 index, 6 docs in them.  
Mapping I used are:  
{  
"settings": {  
"analysis": {  
"filter": {  
"cody\_stop": {  
"type": "stop",  
"stopwords": "_english_"  
},  
"cody\_stemmer": {  
"type": "stemmer",  
"language": "light\_english"  
}  
},  
"analyzer": {  
"cody": {  
"tokenizer": "standard",  
"filter": [  
"lowercase",  
"cody\_stop",  
"cody\_stemmer"  
]  
}  
}  
}  
},  
"mappings": {  
"_default_": {  
"properties": {  
"fileName": {  
"type": "multi\_field",  
"fields": {  
"indexed": {"type": "string",  
"analyzer": "cody"  
},  
"original": {  
"type" : "string",  
"index": "not\_analyzed"  
}  
}  
},  
"content": {  
"type": "string",  
"analyzer": "cody"  
},  
"metaAuthor": {  
"type": "string",  
"analyzer": "cody"  
},  
"metaContent": {  
"type": "string",  
"analyzer": "cody"  
}  
}  
}  
}  
}

The first query got 2 hits, both of them contains this term "tradition(s)".  
{  
"query": {  
"query\_string": {  
"query": "traditions"  
}  
}  
}

The second query got only 1 hit (one of the two results from the first query, it has "traditions" in its fileName). Based on my understanding, these two are essentially the same thing after analyzing them using my customized analyzer.  
{  
"query": {  
"query\_string": {  
"query": "tradition"  
}  
}  
}

Can someone help me out, this is driving me crazy?

Thanks,  
Cody

---

<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:** [March 20, 2016, 4:47am UTC](https://discuss.elastic.co/t/different-results-with-the-same-query-local-single-node-strange/44919/2 "2016-03-20T04:47:16Z")

</div>

How many shards?

---

<div class="post-metadata">

**Author:** ![Yongyao\_Jiang](https://avatars.discourse-cdn.com/v4/letter/y/c4cdca/32.png) [@Yongyao\_Jiang](https://discuss.elastic.co/u/Yongyao_Jiang)\
**Post date:** [March 20, 2016, 5:02am UTC](https://discuss.elastic.co/t/different-results-with-the-same-query-local-single-node-strange/44919/3 "2016-03-20T05:02:16Z")

</div>

Forgot to mention. I have 5 shards by default. Here is part of the results.

Result of query 1:  
"hits": {  
"total": 2,  
"max\_score": 0.08048013,  
"hits": [  
{  
"\_shard": 2,  
"\_node": "TcVGhp8jSDiBezCjtjs\_fg",  
"\_index": "files",  
"\_type": "contentAndMeta",  
"\_id": "AVOLshPh7ne-n0RYZxN9",  
"\_score": 0.08048013,  
"\_source": {  
"fileName": "the four traditions of geography.pdf",  
....  
{  
"\_shard": 2,  
"\_node": "TcVGhp8jSDiBezCjtjs\_fg",  
"\_index": "files",  
"\_type": "contentAndMeta",  
"\_id": "AVOLspsD7ne-n0RYZxOF",  
"\_score": 0.069697835,  
"\_source": {  
"fileName": "the spatial view in context.pdf",

Results of query 2:  
"hits": {  
"total": 1,  
"max\_score": 0.09164428,  
"hits": [  
{  
"\_shard": 2,  
"\_node": "TcVGhp8jSDiBezCjtjs\_fg",  
"\_index": "files",  
"\_type": "contentAndMeta",  
"\_id": "AVOLshPh7ne-n0RYZxN9",  
"\_score": 0.09164428,  
"\_source": {  
"fileName": "the four traditions of geography.pdf",

---

<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:** [March 20, 2016, 5:10am UTC](https://discuss.elastic.co/t/different-results-with-the-same-query-local-single-node-strange/44919/4 "2016-03-20T05:10:00Z")

</div>

What if you reindex with a single shard and try your query again?

---

<div class="post-metadata">

**Author:** ![Yongyao\_Jiang](https://avatars.discourse-cdn.com/v4/letter/y/c4cdca/32.png) [@Yongyao\_Jiang](https://discuss.elastic.co/u/Yongyao_Jiang)\
**Post date:** [March 20, 2016, 5:14am UTC](https://discuss.elastic.co/t/different-results-with-the-same-query-local-single-node-strange/44919/5 "2016-03-20T05:14:51Z")

</div>

Still the same result. May I ask what this has anything with the number of shards? I know it may affect the relevance score, but I don't see why it would result in different number of hits.

Thanks

---

<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, 11:06pm UTC](https://discuss.elastic.co/t/different-results-with-the-same-query-local-single-node-strange/44919/6 "2017-07-05T23:06:49Z")

</div>


