# How can we implement ngram\_anlyzer without affecting the phrase\_search

**URL:** https://discuss.elastic.co/t/how-can-we-implement-ngram-anlyzer-without-affecting-the-phrase-search/18318
**Category:** Elasticsearch
**Created:** [June 25, 2014, 6:13am UTC](https://discuss.elastic.co/t/how-can-we-implement-ngram-anlyzer-without-affecting-the-phrase-search/18318 "2014-06-25T06:13:14Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Anand\_kumar](https://avatars.discourse-cdn.com/v4/letter/a/dfb087/32.png) [@Anand\_kumar](https://discuss.elastic.co/u/Anand_kumar)
#### Post date: [June 25, 2014, 6:13am UTC](https://discuss.elastic.co/t/how-can-we-implement-ngram-anlyzer-without-affecting-the-phrase-search/18318/1 "2014-06-25T06:13:14Z")

</div>

Hi,

I want to search the ngram analyzed data without being affected the results  
of phrase search.

If I used the ngram analyzer, it affects the phrase search results. For  
instance, I'm querying for the string "phrase query", it would display the  
results for exact match, instead it outputs match for "phrase" and "query".  
Here are the settings I've been using, what should be done to get the  
desired result.

"settings" : {  
"index": {  
"analysis" : {  
"analyzer" : {  
"my\_ngram\_analyzer" : {  
"tokenizer" : ["my\_ngram\_tokenizer", "whitespace"],  
"filter" : "lowercase"  
}  
},  
"tokenizer" : {  
"my\_ngram\_tokenizer" : {  
"type" : "nGram",  
"min\_gram" : "3",  
"max\_gram" : "20",  
"token\_chars": ["letter", "digit"]  
}  
}  
}  
}

}

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/c60981f8-d2f1-417e-bc32-170390fed9f8%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/c60981f8-d2f1-417e-bc32-170390fed9f8%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 1:19am UTC](https://discuss.elastic.co/t/how-can-we-implement-ngram-anlyzer-without-affecting-the-phrase-search/18318/2 "2017-07-06T01:19:58Z")

</div>


