# NGramTokenFilter: Unknown field 'token\_chars'

**URL:** <https://discuss.elastic.co/t/ngramtokenfilter-unknown-field-token-chars/348532>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [December 4, 2023, 8:43am UTC](https://discuss.elastic.co/t/ngramtokenfilter-unknown-field-token-chars/348532 "2023-12-04T08:43:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rohit\_Gaur](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rohit_gaur/32/128585_2.png) [@Rohit\_Gaur](https://discuss.elastic.co/u/Rohit_Gaur)\
**Post date:** [December 4, 2023, 8:43am UTC](https://discuss.elastic.co/t/ngramtokenfilter-unknown-field-token-chars/348532/1 "2023-12-04T08:43:53Z")

</div>

I am upgrading my Elasticsearch to 8.9 while creating documents using Elasticsearch client I faced the following error

co.elastic.clients.json.JsonpMappingException: Error deserializing co.elastic.clients.elasticsearch.\_types.analysis.NGramTokenFilter: Unknown field 'token\_chars' (JSON path: settings.index.analysis.filter.nGram\_filter.token\_chars)

While the index gets created on Kibana with the same mapping but I want it to make it from Elasticsearch client

Using these Elasticsearch versions and clients  
elasticsearch-java - 8.9.1  
elasticsearch-rest-client - 8.9.1  
Java - 17

Here is the mapping code -

```auto
{ 
    "mappings" : 
        {
            "properties": {
                "suggestion": {
                    "type": "text",
                        "fields": {
                            "analyzed": {
                                "type": "text",
                                "analyzer": "nGram_analyzer",
                                "search_analyzer": "whitespace"
                                }
                            }
                        },
                            "weight": {
                            "type": "integer"
                            }
            }   
        }, 
    "settings" :            
        {
        "number_of_shards": 1,
        "number_of_replicas": 1,
        "max_ngram_diff" : 20,
        "index": {
            "analysis": {
                "analyzer": {
                "nGram_analyzer": {
                    "type": "custom",
                    "tokenizer": "whitespace",
                    "filter": [
                        "lowercase",
                        "asciifolding",
                        "nGram_filter"
                        ]
                    }
                },
                "filter": {
                    "nGram_filter": {
                        "type": "ngram",
                        "min_gram": 2,
                        "max_gram": 20,
                        "token_chars": [
                            "letter",
                            "digit",
                            "punctuation",
                            "symbol"
                        ]
                    }
                }
            }
        }
    }
} 

```

---

<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:** [January 1, 2024, 8:44am UTC](https://discuss.elastic.co/t/ngramtokenfilter-unknown-field-token-chars/348532/2 "2024-01-01T08:44:32Z")

</div>

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