# How do I do ngram searches?

**URL:** <https://discuss.elastic.co/t/how-do-i-do-ngram-searches/13830>\
**Category:** Elasticsearch\
**Created:** [October 2, 2013, 7:30pm UTC](https://discuss.elastic.co/t/how-do-i-do-ngram-searches/13830 "2013-10-02T19:30:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Arthur\_Pemberton](https://avatars.discourse-cdn.com/v4/letter/a/8797f3/32.png) [@Arthur\_Pemberton](https://discuss.elastic.co/u/Arthur_Pemberton)\
**Post date:** [October 2, 2013, 7:30pm UTC](https://discuss.elastic.co/t/how-do-i-do-ngram-searches/13830/1 "2013-10-02T19:30:14Z")

</div>

I am finding myself unable to do ngram searches. And by that, I mean I  
can't find 'heating' when I do a search for 'heat'.

I have setup the index with the following settings:

{  
'settings': {  
"analysis": {  
"analyzer": {  
"ngram\_analyzer": {  
"type": "custom",  
"tokenizer": "lowercase",  
"filter": ["standard", "lowercase", "stop", "kstem", "haystack\_ngram"]  
}  
},  
"tokenizer": {  
"haystack\_ngram\_tokenizer": {  
"type": "nGram",  
"min\_gram": 3,  
"max\_gram": 15,  
"token\_chars": ["letter", "digit"],  
}  
},  
"filter": {  
"haystack\_ngram": {  
"type": "nGram",  
"min\_gram": 3,  
"max\_gram": 15  
}  
}  
}  
}

And I have data in there. I can do searches on heating and receive results,  
but no results when I search for heat using a query\_string search.

I have used the contents of the stored/index data and ran it against  
\_analyze with `analyzer=ngram_analyzer` and the tokens look good. But doing  
a search using any of the generated tokens yield no results. I'm very  
confused.

I have set 'analyzer', 'index\_analyzer', and '' to 'search\_analyzer' -- no  
go. I've rebuilt the index after ever change -- no go.

I'm in need of help, please advise.

--  
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:13am UTC](https://discuss.elastic.co/t/how-do-i-do-ngram-searches/13830/2 "2017-07-06T02:13:59Z")

</div>


