# Help with Ngrams - also index non-Ngrams

**URL:** <https://discuss.elastic.co/t/help-with-ngrams-also-index-non-ngrams/10953>\
**Category:** Elasticsearch\
**Created:** [February 28, 2013, 3:22pm UTC](https://discuss.elastic.co/t/help-with-ngrams-also-index-non-ngrams/10953 "2013-02-28T15:22:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Per\_Ekman](https://avatars.discourse-cdn.com/v4/letter/p/e9bcb4/32.png) [@Per\_Ekman](https://discuss.elastic.co/u/Per_Ekman)\
**Post date:** [February 28, 2013, 3:22pm UTC](https://discuss.elastic.co/t/help-with-ngrams-also-index-non-ngrams/10953/1 "2013-02-28T15:22:15Z")

</div>

Hi

We are trying to use ngrams in our index. Currently we have this  
configuration:

```
                "ngram":{
                    "tokenizer":"whitespace",
                    "filter":[
                        "standard",
                        "lowercase",
                        "ngram",
                        "catenate_words"
                    ]
                },

```

....  
"ngram":{  
"type":"nGram",  
"min\_gram":3,  
"max\_gram":50  
},

When looking at a term like "mc donalds" we see that the "mc" part is not  
put into the index. Anybody have an idea of how to configure the index so  
that we get "mc" as well as "don", "ald" etc (without changing the min\_gram  
setting)?

/Per

--  
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:** ![roytmana](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/roytmana/32/44855_2.png) [@roytmana](https://discuss.elastic.co/u/roytmana)\
**Post date:** [March 1, 2013, 2:32am UTC](https://discuss.elastic.co/t/help-with-ngrams-also-index-non-ngrams/10953/2 "2013-03-01T02:32:19Z")

</div>

I believe it's min\_gram:3 setting which prevents any terms shorter than 3  
characters to be an ngram

On Thursday, February 28, 2013 10:22:15 AM UTC-5, Per Ekman wrote:

> Hi
> 
> We are trying to use ngrams in our index. Currently we have this  
> configuration:
> 
> ```
> "ngram":{
> "tokenizer":"whitespace",
> "filter":[
> "standard",
> "lowercase",
> "ngram",
> "catenate_words"
> ]
> },
> 
> ```
> 
> ....  
> "ngram":{  
> "type":"nGram",  
> "min\_gram":3,  
> "max\_gram":50  
> },
> 
> When looking at a term like "mc donalds" we see that the "mc" part is not  
> put into the index. Anybody have an idea of how to configure the index so  
> that we get "mc" as well as "don", "ald" etc (without changing the min\_gram  
> setting)?
> 
> /Per

--  
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:** ![simonw\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/simonw_2/32/1130_2.png) [@simonw\_2](https://discuss.elastic.co/u/simonw_2)\
**Post date:** [March 1, 2013, 11:05am UTC](https://discuss.elastic.co/t/help-with-ngrams-also-index-non-ngrams/10953/3 "2013-03-01T11:05:07Z")

</div>

I am afraid you can't do this at this point. Terms shorter that the  
min-gram size will always be dropped (swallowed).

simon

On Thursday, February 28, 2013 4:22:15 PM UTC+1, Per Ekman wrote:

> Hi
> 
> We are trying to use ngrams in our index. Currently we have this  
> configuration:
> 
> ```
> "ngram":{
> "tokenizer":"whitespace",
> "filter":[
> "standard",
> "lowercase",
> "ngram",
> "catenate_words"
> ]
> },
> 
> ```
> 
> ....  
> "ngram":{  
> "type":"nGram",  
> "min\_gram":3,  
> "max\_gram":50  
> },
> 
> When looking at a term like "mc donalds" we see that the "mc" part is not  
> put into the index. Anybody have an idea of how to configure the index so  
> that we get "mc" as well as "don", "ald" etc (without changing the min\_gram  
> setting)?
> 
> /Per

--  
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:** ![Per\_Ekman](https://avatars.discourse-cdn.com/v4/letter/p/e9bcb4/32.png) [@Per\_Ekman](https://discuss.elastic.co/u/Per_Ekman)\
**Post date:** [March 4, 2013, 2:38pm UTC](https://discuss.elastic.co/t/help-with-ngrams-also-index-non-ngrams/10953/4 "2013-03-04T14:38:34Z")

</div>

alright, I guess we'll have to use the combo-plugin in some way to do it

On Fri, Mar 1, 2013 at 12:05 PM, simonw  
[simon.willnauer@elasticsearch.com](mailto:simon.willnauer@elasticsearch.com)wrote:

> I am afraid you can't do this at this point. Terms shorter that the  
> min-gram size will always be dropped (swallowed).
> 
> simon
> 
> On Thursday, February 28, 2013 4:22:15 PM UTC+1, Per Ekman wrote:
> 
> > Hi
> > 
> > We are trying to use ngrams in our index. Currently we have this  
> > configuration:
> > 
> > ```
> > "ngram":{
> > "tokenizer":"whitespace",
> > "filter":[
> > "standard",
> > "lowercase",
> > "ngram",
> > "catenate_words"
> > ]
> > },
> > 
> > ```
> > 
> > ....  
> > "ngram":{  
> > "type":"nGram",  
> > "min\_gram":3,  
> > "max\_gram":50  
> > },
> > 
> > When looking at a term like "mc donalds" we see that the "mc" part is not  
> > put into the index. Anybody have an idea of how to configure the index so  
> > that we get "mc" as well as "don", "ald" etc (without changing the min\_gram  
> > setting)?
> > 
> > /Per
> 
> --  
> You received this message because you are subscribed to a topic in the  
> Google Groups "elasticsearch" group.  
> To unsubscribe from this topic, visit  
> [https://groups.google.com/d/topic/elasticsearch/XW-zteIb6y0/unsubscribe?hl=en-US](https://groups.google.com/d/topic/elasticsearch/XW-zteIb6y0/unsubscribe?hl=en-US)  
> .  
> To unsubscribe from this group and all its topics, 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:48am UTC](https://discuss.elastic.co/t/help-with-ngrams-also-index-non-ngrams/10953/5 "2017-07-06T02:48:35Z")

</div>


