# Search results vary with max\_expansion across jvm

**URL:** <https://discuss.elastic.co/t/search-results-vary-with-max-expansion-across-jvm/127754>\
**Category:** Elasticsearch\
**Created:** [April 12, 2018, 7:43am UTC](https://discuss.elastic.co/t/search-results-vary-with-max-expansion-across-jvm/127754 "2018-04-12T07:43:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gauravbhatt13](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gauravbhatt13/32/11414_2.png) [@gauravbhatt13](https://discuss.elastic.co/u/gauravbhatt13)\
**Post date:** [April 12, 2018, 7:43am UTC](https://discuss.elastic.co/t/search-results-vary-with-max-expansion-across-jvm/127754/1 "2018-04-12T07:43:35Z")

</div>

I have created an index using an input data file in one machine. I again created a new index with the same input data file in different machine. I execute following query in both machines:

{  
"fields":["AD10"],  
"from": 0,  
"size": 5000,  
"query": {  
"bool": {  
"must": {  
"match\_all": {}  
},  
"filter": {  
"bool": {  
"must": {  
"match": {  
"AD10": {  
"query": "roma",  
"type": "phrase\_prefix",  
"max\_expansions" : 124,  
"boost": 1  
}  
}  
}  
}  
}  
}  
}  
}

The issue is that I get different hit count, 2017 in one machine and 2085 in the other. Then I dig more and used explain = true and found that the new terms array of 124 (max\_expansions) terms created for prefix match in both machines is different. It seems that ES is picking random list of terms for prefix matching rather then incrementally adding terms to the list in ascending order which seems to be a bug. Please help.

---

<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:** [May 10, 2018, 7:43am UTC](https://discuss.elastic.co/t/search-results-vary-with-max-expansion-across-jvm/127754/2 "2018-05-10T07:43:37Z")

</div>

Closed on May 10, 2018, 7:43am UTC

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