# Can I use matchPhrasePrefixQuery and fuzziness at the same time?

**URL:** <https://discuss.elastic.co/t/can-i-use-matchphraseprefixquery-and-fuzziness-at-the-same-time/177726>\
**Category:** Elasticsearch\
**Created:** [April 20, 2019, 6:46pm UTC](https://discuss.elastic.co/t/can-i-use-matchphraseprefixquery-and-fuzziness-at-the-same-time/177726 "2019-04-20T18:46:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aswini\_Kumar\_Rout](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aswini_kumar_rout/32/42165_2.png) [@Aswini\_Kumar\_Rout](https://discuss.elastic.co/u/Aswini_Kumar_Rout)\
**Post date:** [April 20, 2019, 6:46pm UTC](https://discuss.elastic.co/t/can-i-use-matchphraseprefixquery-and-fuzziness-at-the-same-time/177726/1 "2019-04-20T18:46:42Z")

</div>

I am using Elasticsearch 6.5 and when I use **matchPhrasePrefixQuery** it works fine.  
For Example I have documents like  
1. **spiderman is climbing**  
2. **spiderman**  
3. **spider**  
When I type " **s**" I got all this using **matchPhrasePrefixQuery** But when I am using fuzziness 1st of all I can't use **matchPhrasePrefixQuery** so instead of that I am using **matchQuery** so I need to type a full word to get the results like with only " **s**" I am not getting any result and with " **pider**" I am getting only **spider** instead of only **spider** I need all the 3 results and I am expecting all the results when I type only " **s**" also.

Means I want the behaviour of **matchPhrasePrefixQuery** with **fuzziness**.

So,is there any way to achieve this requirement???

---

<div class="post-metadata">

**Author:** ![Aswini\_Kumar\_Rout](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aswini_kumar_rout/32/42165_2.png) [@Aswini\_Kumar\_Rout](https://discuss.elastic.co/u/Aswini_Kumar_Rout)\
**Post date:** [April 28, 2019, 4:36pm UTC](https://discuss.elastic.co/t/can-i-use-matchphraseprefixquery-and-fuzziness-at-the-same-time/177726/2 "2019-04-28T16:36:20Z")

</div>

Can anybody please help me in this requirement as I am not getting any way to proceed.

---

<div class="post-metadata">

**Author:** ![val](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/val/32/138203_2.png) [@val](https://discuss.elastic.co/u/val)\
**Post date:** [May 1, 2019, 1:24pm UTC](https://discuss.elastic.co/t/can-i-use-matchphraseprefixquery-and-fuzziness-at-the-same-time/177726/3 "2019-05-01T13:24:09Z")

</div>

I would try to use the [completion suggester](https://www.elastic.co/guide/en/elasticsearch/reference/6.5/search-suggesters-completion.html), since its job is pretty much exactly what you're looking for (i.e. match phrase prefix), and it supports fuzziness as well. Beware with fuzziness, though, as it might bite you.

Try it out and let us know.

---

<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 29, 2019, 1:24pm UTC](https://discuss.elastic.co/t/can-i-use-matchphraseprefixquery-and-fuzziness-at-the-same-time/177726/4 "2019-05-29T13:24:11Z")

</div>

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