# Tokens outside the ngram size

**URL:** https://discuss.elastic.co/t/tokens-outside-the-ngram-size/6499
**Category:** Elasticsearch
**Created:** [January 25, 2012, 7:19pm UTC](https://discuss.elastic.co/t/tokens-outside-the-ngram-size/6499 "2012-01-25T19:19:26Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![John\_Downey](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/john_downey/32/3272_2.png) [@John\_Downey](https://discuss.elastic.co/u/John_Downey)
#### Post date: [January 25, 2012, 7:19pm UTC](https://discuss.elastic.co/t/tokens-outside-the-ngram-size/6499/1 "2012-01-25T19:19:26Z")

</div>

I am in the process of setting up elasticsearch in our infrastructure. The initial setup includes a custom analyzer with an ngram filter (min 3/max 20) set as the index\_analyzer on two mappings. We have one free-form text field that searches will be entered from (Google style). Currently this text is being used to search the \_all field with a query\_string query.

While testing I noticed that tokens smaller than the ngram size are not being matched during searches. My expectation is that perfect matches would still result in the document matching.

Is there a way to configure the analyzer so that the \_all field can be searched with ngrams and still find perfect matches outside the ngram size?

--  
John Downey

---

<div class="post-metadata">

### Author: ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)
#### Post date: [January 25, 2012, 9:48pm UTC](https://discuss.elastic.co/t/tokens-outside-the-ngram-size/6499/2 "2012-01-25T21:48:09Z")

</div>

You mean the \_all field to have two different analyzers? No, it can only have one.

On Wednesday, January 25, 2012 at 9:19 PM, John Downey wrote:

> I am in the process of setting up elasticsearch in our infrastructure. The initial setup includes a custom analyzer with an ngram filter (min 3/max 20) set as the index\_analyzer on two mappings. We have one free-form text field that searches will be entered from (Google style). Currently this text is being used to search the \_all field with a query\_string query.
> 
> While testing I noticed that tokens smaller than the ngram size are not being matched during searches. My expectation is that perfect matches would still result in the document matching.
> 
> Is there a way to configure the analyzer so that the \_all field can be searched with ngrams and still find perfect matches outside the ngram size?
> 
> --  
> John Downey

---

<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, 3:41am UTC](https://discuss.elastic.co/t/tokens-outside-the-ngram-size/6499/3 "2017-07-06T03:41:28Z")

</div>


