1
votes

OS: #1 SMP Debian 4.19.152-1 (2020-10-18)

Install elastic by this tutorial https://www.elastic.co/guide/en/elasticsearch/reference/current/deb.html:

{
  "name" : "web",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "HSeOQvkHRey2P_JN2Nv-GA",
  "version" : {
    "number" : "7.10.0",
    "build_flavor" : "default",
    "build_type" : "deb",
    "build_hash" : "51e9d6f22758d0374a0f3f5c6e8f3a7997850f96",
    "build_date" : "2020-11-09T21:30:33.964949Z",
    "build_snapshot" : false,
    "lucene_version" : "8.7.0",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

How globally change some index creation options https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules.html? Such as index.max_ngram_diff as example?

2

2 Answers

1
votes

You need to use the index update settings API:

PUT your-index/_settings
{
  "index.max_ngram_diff": 2
}

If you want this setting to be applied on index that are going to be created in the future, you can create an index template that will be applied to the matching future indexes:

PUT /_index_template/template_1
{
  "index_patterns" : ["my-index-*"],
  "priority" : 1,
  "template": {
    "settings" : {
      "index.max_ngram_diff" : 2
    }
  }
}

After that, every time that you create a new index whose name matches my-index-*, that new index will get the settings set in the template.

0
votes

I will recommend to use Index templates for this. You can preconfigure template with settings you need, and use on index creation.