# Use of match phrase prefix query

**URL:** <https://discuss.elastic.co/t/use-of-match-phrase-prefix-query/59265>\
**Category:** Elasticsearch\
**Created:** [August 30, 2016, 3:11am UTC](https://discuss.elastic.co/t/use-of-match-phrase-prefix-query/59265 "2016-08-30T03:11:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![caoyang1024](https://avatars.discourse-cdn.com/v4/letter/c/f19dbf/32.png) [@caoyang1024](https://discuss.elastic.co/u/caoyang1024)\
**Post date:** [August 30, 2016, 3:11am UTC](https://discuss.elastic.co/t/use-of-match-phrase-prefix-query/59265/1 "2016-08-30T03:11:18Z")

</div>

Hi all,

i have a bool query, contains 3 different match query, the problem is when i search an address for example 'amk 549' or '549 amk' it will return me different results.

- HORIZON GARDENS 549 ANG MO KIO AVENUE 2, SINGAPORE 567930
- CHENG SAN PLACE 549 ANG MO KIO AVENUE 10, SINGAPORE 560549

i have synonym ( **amk** is equals to **ang mo kio** )

when i search 549 amk, both results will show, but if i search amk 549, no results will return. how can i resolve this.

i guess the **match\_phrase\_prefix** will try to find text in order, when the order is not match, it wont return, but if i remove this phrase\_prefix, i will lose this phrase\_prefix function.

query:{  
bool: {  
should:[  
{  
match: {  
searchText: {  
query: q,  
operator: 'and'  
}  
}  
},  
{  
match: {  
searchText: {  
query: q,  
fuzziness: 1,  
prefix\_length: 0  
}  
}  
},  
{  
match: {  
searchText: {  
query: q,  
max\_expansions: 300,  
type: 'phrase\_prefix'  
}  
}  
}  
]  
}  
}

---

<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:24pm UTC](https://discuss.elastic.co/t/use-of-match-phrase-prefix-query/59265/2 "2017-07-05T22:24:16Z")

</div>


