# Ngram search whole word

**URL:** <https://discuss.elastic.co/t/ngram-search-whole-word/168336>\
**Category:** Elasticsearch\
**Created:** [February 14, 2019, 6:07am UTC](https://discuss.elastic.co/t/ngram-search-whole-word/168336 "2019-02-14T06:07:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paddy\_Mahadeva](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/paddy_mahadeva/32/44225_2.png) [@Paddy\_Mahadeva](https://discuss.elastic.co/u/Paddy_Mahadeva)\
**Post date:** [February 14, 2019, 6:07am UTC](https://discuss.elastic.co/t/ngram-search-whole-word/168336/1 "2019-02-14T06:07:50Z")

</div>

Hi,

Trying to use ngram for first time to solve a search problem.

We have a case where we need to do partial mach of input data.

Lets say I have the following data in my user index in the name field

Doc 1 : Jean Claude Van Damme  
Doc 2 : Jean Claude Vandamme  
Doc 3 : Jean Van Damme  
Doc 4 : Jean Jhonny Dammy

and I search for Jean or Jean Claude. its straight forward I get the results expected. But when I search for Damme. I need to ensure that I get only the first 3 docs and not that last one. When I use ngram I see that it returns 4th doc also as result as I have set min\_gram as 3, I can't increase it to 5 as my minimum seach support is 3 characters.

I cannot predict what my user will input, she may input 3 characters or 5 characters or 10 characters. What I need is that all those characters entered should be there in the document matched without fail. How can I achieve this?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [February 14, 2019, 6:29am UTC](https://discuss.elastic.co/t/ngram-search-whole-word/168336/2 "2019-02-14T06:29:43Z")

</div>

Try to define a `search_analyzer` as `simple` in addition to the ngram `analyzer`.

---

<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:** [March 14, 2019, 6:29am UTC](https://discuss.elastic.co/t/ngram-search-whole-word/168336/3 "2019-03-14T06:29:48Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
