Index settings in configuration file does not take effect

I want to add some index global settings in the configuration file elasticsearch.yml, however, the index settings do not take effect in the config file.

I'm using the Elasticsearch 2.x whether on Mac or in docker container

here are steps to reproduce it

on Mac:

brew install elasticsearch@2.4

cat >> /usr/local/etc/elasticsearch/elasticsearch.yml << EOF
index:
    number_of_shards: 2
    refresh_interval: 50s
    max_result_window: 20000
EOF

brew services start elasticsearch@2.4

curl -H 'Content-Type: application/x-ndjson' -XPOST 'localhost:9200/account/' -d '{"index":{"_id":"1"}}'

curl http://127.0.0.1:9200/_all/_settings\?pretty
{
  "account" : {
    "settings" : {
      "index" : {
        "_id" : "1",
        "creation_date" : "1514178481311",
        "number_of_shards" : "5",
        "number_of_replicas" : "1",
        "uuid" : "O8w2TyZnQCqYZymuN0klmg",
        "version" : {
          "created" : "2040699"
        }
      }
    }
  }
}

In container:

The result is same when using the docker container with image of elasticsearch:2.4-alpine
the image is from docker hub since there is no the image for 2.x version from the official site.

Am I missing something or doing wrong in there? since that there are several introductions about the add index settings in the configuration file (I know it not possible doing it after 5.x version)

I don't think everything is reflected via the APIs. Have you created an index to check if they are applied?

Setting index settings in elasticsearch.yml is not supported anymore from 5.x anyway.
Use index templates instead.

1 Like

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