Error trying to update index setting "max_ngram_diff"

In an attempt to reset my index settings to use the default for max_ngram_diff, I used the PUT <myindex>/_settings API to set this property to null, which successfully removed it from that index's explicit settings.

Now, any attempt to use the PUT <myindex>/_settings API results in the following error:

{
  "error": {
    "root_cause": [
      {
        "type": "illegal_argument_exception",
        "reason": "The difference between max_gram and min_gram in NGram Tokenizer must be less than or equal to: [1] but was [29]. This limit can be set by changing the [index.max_ngram_diff] index level setting."
      }
    ],
    "type": "illegal_argument_exception",
    "reason": "The difference between max_gram and min_gram in NGram Tokenizer must be less than or equal to: [1] but was [29]. This limit can be set by changing the [index.max_ngram_diff] index level setting."
  },
  "status": 400
}

I get this error even if I try to set the "max_ngram_diff" back to what it was (50), such as with the following command:

PUT clients-index01/_settings
{
  "index": {
    "max_ngram_diff": 50
  }
}

Here is the result of GET clients-index01/_settings if it helps. You'll notice it does have an ngram tokenizer definition with a min of 1 and max of 30, explaining the error message. But any attempt to change this with the PUT settings API results in the error above. Is there another way to update these settings without using the API call?

{
  "clients-index01" : {
    "settings" : {
      "index" : {
        "verified_before_close" : "true",
        "number_of_shards" : "1",
        "blocks" : {
          "read_only_allow_delete" : "false",
          "read_only" : "false"
        },
        "provided_name" : "clients-index01",
        "creation_date" : "1571270642016",
        "requests" : {
          "cache" : {
            "enable" : "true"
          }
        },
        "analysis" : {
          "normalizer" : {
            "keywordNormalizer" : {
              "filter" : [
                "lowercase",
                "asciifolding"
              ],
              "type" : "custom",
              "char_filter" : [ ]
            }
          },
          "analyzer" : {
            "ngramLowerCase" : {
              "filter" : [
                "lowercase"
              ],
              "type" : "custom",
              "tokenizer" : "ngram"
            },
            "keywordLowercase" : {
              "filter" : [
                "lowercase"
              ],
              "type" : "custom",
              "tokenizer" : "keyword"
            }
          },
          "tokenizer" : {
            "ngram" : {
              "type" : "ngram",
              "min_gram" : "1",
              "max_gram" : "30"
            }
          }
        },
        "number_of_replicas" : "0",
        "uuid" : "i2YRN0FNS8-CJbLBZ6YvKw",
        "version" : {
          "created" : "7040099"
        }
      }
    }
  }
}

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