# "phrase\_prefix" not working for some prefixes

**URL:** https://discuss.elastic.co/t/phrase-prefix-not-working-for-some-prefixes/12456
**Category:** Elasticsearch
**Created:** [June 18, 2013, 9:19am UTC](https://discuss.elastic.co/t/phrase-prefix-not-working-for-some-prefixes/12456 "2013-06-18T09:19:32Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Anda\_Cipariu](https://avatars.discourse-cdn.com/v4/letter/a/dc4da7/32.png) [@Anda\_Cipariu](https://discuss.elastic.co/u/Anda_Cipariu)
#### Post date: [June 18, 2013, 9:19am UTC](https://discuss.elastic.co/t/phrase-prefix-not-working-for-some-prefixes/12456/1 "2013-06-18T09:19:32Z")

</div>

Hi,

I am trying to make a phrase prefix search on an index that uses the  
default analyzer but it seems that it is not working if the word starts  
with some letters:

For example :

"query":{"match":{"user":{"query":"an","type":"phrase\_prefix"}}}}  
"query":{"match":{"user":{"query":"and","type":"phrase\_prefix"}}}}  
"query":{"match":{"user":{"query":"in","type":"phrase\_prefix"}}}}  
"query":{"match":{"user":{"query":"or","type":"phrase\_prefix"}}}}

return no result

but

"query":{"match":{"user":{"query":"de","type":"phrase\_prefix"}}}}  
"query":{"match":{"user":{"query":"ds","type":"phrase\_prefix"}}}}  
"query":{"match":{"user":{"query":"anda","type":"phrase\_prefix"}}}}  
"query":{"match":{"user":{"query":"inl","type":"phrase\_prefix"}}}}  
"query":{"match":{"user":{"query":"orb","type":"phrase\_prefix"}}}}

return the expected result

I believe this has something to do with the operators "and", "or", "in" .

Is there a way I can make the phrase\_prefix work when searching for any  
prefix?

Thank you

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)
#### Post date: [June 24, 2013, 1:34pm UTC](https://discuss.elastic.co/t/phrase-prefix-not-working-for-some-prefixes/12456/2 "2013-06-24T13:34:23Z")

</div>

Hey,

The queries, which do not return any data are actually stopwords. Stopwords  
are removed, resulting in an empty query, which is not returning anything.  
If you do not want stopwords to be removed, you might want to change your  
analyzers.

--Alex

On Tue, Jun 18, 2013 at 11:19 AM, Anda Cipariu [andacipariu@gmail.com](mailto:andacipariu@gmail.com)wrote:

> Hi,
> 
> I am trying to make a phrase prefix search on an index that uses the  
> default analyzer but it seems that it is not working if the word starts  
> with some letters:
> 
> For example :
> 
> "query":{"match":{"user":{"query":"an","type":"phrase\_prefix"}}}}  
> "query":{"match":{"user":{"query":"and","type":"phrase\_prefix"}}}}  
> "query":{"match":{"user":{"query":"in","type":"phrase\_prefix"}}}}  
> "query":{"match":{"user":{"query":"or","type":"phrase\_prefix"}}}}
> 
> return no result
> 
> but
> 
> "query":{"match":{"user":{"query":"de","type":"phrase\_prefix"}}}}  
> "query":{"match":{"user":{"query":"ds","type":"phrase\_prefix"}}}}  
> "query":{"match":{"user":{"query":"anda","type":"phrase\_prefix"}}}}  
> "query":{"match":{"user":{"query":"inl","type":"phrase\_prefix"}}}}  
> "query":{"match":{"user":{"query":"orb","type":"phrase\_prefix"}}}}
> 
> return the expected result
> 
> I believe this has something to do with the operators "and", "or", "in" .
> 
> Is there a way I can make the phrase\_prefix work when searching for any  
> prefix?
> 
> Thank you
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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 6, 2017, 2:29am UTC](https://discuss.elastic.co/t/phrase-prefix-not-working-for-some-prefixes/12456/3 "2017-07-06T02:29:48Z")

</div>


