NGramTokenFilter: Unknown field 'token_chars'

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 -

{ 
    "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"
                        ]
                    }
                }
            }
        }
    }
} 

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