# Match\_phrase\_prefix in Elasticsearch 7.3.0

**URL:** <https://discuss.elastic.co/t/match-phrase-prefix-in-elasticsearch-7-3-0/202894>\
**Category:** Elasticsearch\
**Created:** [October 9, 2019, 6:17pm UTC](https://discuss.elastic.co/t/match-phrase-prefix-in-elasticsearch-7-3-0/202894 "2019-10-09T18:17:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![valentine-dev](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/valentine-dev/32/52868_2.png) [@valentine-dev](https://discuss.elastic.co/u/valentine-dev)\
**Post date:** [October 9, 2019, 6:17pm UTC](https://discuss.elastic.co/t/match-phrase-prefix-in-elasticsearch-7-3-0/202894/1 "2019-10-09T18:17:15Z")

</div>

Why I got 7 results for "6531 148 str" but no results for "6531 148 st"?

Is it because there are more than 50 terms in the sorted term dictionary between "st" and "str" based on [https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-query-phrase-prefix.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-query-phrase-prefix.html)? And for each of those terms, there is no search result?

Thanks!

[Case 1]

- Request  
GET /\_search  
{  
"query": {  
"match\_phrase\_prefix" : {  
"address" : "6531 148 st"  
}  
}  
}
- Response  
{  
"took": 11,  
"timed\_out": false,  
"\_shards": {  
"total": 3,  
"successful": 3,  
"skipped": 0,  
"failed": 0  
},  
"hits": {  
"total": {  
"value": 0,  
"relation": "eq"  
},  
"max\_score": null,  
"hits":   
}  
}

[Case 2]

- Request  
GET /\_search  
{  
"query": {  
"match\_phrase\_prefix" : {  
"address" : "6531 148 str"  
}  
}  
}
- Response  
{  
"took": 668,  
"timed\_out": false,  
"\_shards": {  
"total": 3,  
"successful": 3,  
"skipped": 0,  
"failed": 0  
},  
"hits": {  
"total": {  
"value": 7,  
"relation": "eq"  
},  
......

---

<div class="post-metadata">

**Author:** ![abdon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/abdon/32/9195_2.png) [@abdon](https://discuss.elastic.co/u/abdon)\
**Post date:** [October 10, 2019, 12:44pm UTC](https://discuss.elastic.co/t/match-phrase-prefix-in-elasticsearch-7-3-0/202894/2 "2019-10-10T12:44:24Z")

</div>

Yes, that could very well be it. There could be many more than 50 terms that start with `st` and as a result you may miss out on `street`. You could try increasing `max_expansions` to a higher number, but keep in mind that this will make the query more expensive.

---

<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:** [November 7, 2019, 12:44pm UTC](https://discuss.elastic.co/t/match-phrase-prefix-in-elasticsearch-7-3-0/202894/3 "2019-11-07T12:44:26Z")

</div>

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