# Partial word search does not work with Ngram Analyzer!

**URL:** <https://discuss.elastic.co/t/partial-word-search-does-not-work-with-ngram-analyzer/100284>\
**Category:** Elasticsearch\
**Created:** [September 13, 2017, 5:03am UTC](https://discuss.elastic.co/t/partial-word-search-does-not-work-with-ngram-analyzer/100284 "2017-09-13T05:03:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nima](https://avatars.discourse-cdn.com/v4/letter/n/9dc877/32.png) [@Nima](https://discuss.elastic.co/u/Nima)\
**Post date:** [September 13, 2017, 5:03am UTC](https://discuss.elastic.co/t/partial-word-search-does-not-work-with-ngram-analyzer/100284/1 "2017-09-13T05:03:17Z")

</div>

Despairly trying to add n-gram to an index but no effect! I try dozen combination but still does not have partial word matching!

```
            ICreateIndexResponse indexResult = await _elasticClient.CreateIndexAsync("product", p => p
            .Mappings(m => m.Map<ProductDetailModel>(c => c.AutoMap()))    
            .Settings(setting => setting
                        .TokenFilters(t => t.NGram("nGram", ng => ng.MinGram(2).MaxGram(2)))
                        .Analyzers(an => an
                             .Custom("test", ca => ca
                                 .Tokenizer("standard")
                                 .Filters("nGram" )
                        )
                    )
                 )
               )
            );

```

Here is the query

```
{
  "query": {
       "match" : { "name" : "gra" } 
  }
}

```

Thanks in advance

---

<div class="post-metadata">

**Author:** ![forloop](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/forloop/32/9021_2.png) [@forloop](https://discuss.elastic.co/u/forloop)\
**Post date:** [September 13, 2017, 5:51am UTC](https://discuss.elastic.co/t/partial-word-search-does-not-work-with-ngram-analyzer/100284/2 "2017-09-13T05:51:47Z")

</div>

On the basis of what you've provided, a custom analyzer is set up to use the `nGram` token filter, but this analyzer is not being used for any of the fields on `ProductDetailModel` or anywhere else in the index.

[Take a look at the documentation on writing analyzers](https://www.elastic.co/guide/en/elasticsearch/client/net-api/current/writing-analyzers.html) for how to hook up the analyzer to a field.

---

<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:** [October 11, 2017, 5:52am UTC](https://discuss.elastic.co/t/partial-word-search-does-not-work-with-ngram-analyzer/100284/3 "2017-10-11T05:52:09Z")

</div>

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