Unexpected behaviour for auto_create_index

Hi,
I have a question about the cluster setting "action.auto_create_index". I set it to "false" to avoid indices from being created automatically when a PUT is sent to index a document.
It works without problem when I use it on a local Elasticsearch instance running in docker.
But when I use the same setting on Elastic Cloud it does not seem to work. When I PUT a document the index is still created without an error message.
Is there any additional setting that I have to make for this to work in Elastic Cloud?

Thanks.

Hi @hapeka Welcome to using to the community and thanks for trying Elastic Cloud.

Can you please show us the steps you took on Elastic Cloud and then the results, perhaps we can then help.

Hmm I just test with my Elastic Cloud


PUT _cluster/settings
{
  "persistent": {
      "action.auto_create_index" : false
  }
}


POST discuss-test-index/_doc
{
  "name" : "value"
}

# Result
{
  "error" : {
    "root_cause" : [
      {
        "type" : "index_not_found_exception",
        "reason" : "no such index [discuss-test-index] and [action.auto_create_index] is [false]",
        "index_uuid" : "_na_",
        "index" : "discuss-test-index"
      }
    ],
    "type" : "index_not_found_exception",
    "reason" : "no such index [discuss-test-index] and [action.auto_create_index] is [false]",
    "index_uuid" : "_na_",
    "index" : "discuss-test-index"
  },
  "status" : 404
}
1 Like

I have set the auto_create_index to false with the same command that you used.
But I indexed the document with

PUT some-index/_doc/some-id
{
    "name": "value"
}

and this works (unexpectedly) without error.
But actually the POST also works for me.

Now I have found the solution. I have recently migrated the cluster to 7.16.1 from an earlier version, but wasn't aware of the transient settings (see Transient settings migration guide | Elasticsearch Guide [7.16] | Elastic)

After running

PUT _cluster/settings
{
    "persistent": {
        "action.auto_create_index": "false"
    },
    "transient": {
        "*": null
    }
}

it now works like expected (returning an error).

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