# Unexpected behaviour for auto\_create\_index

**URL:** <https://discuss.elastic.co/t/unexpected-behaviour-for-auto-create-index/292487>\
**Category:** Elasticsearch\
**Tags:** docker\
**Created:** [December 20, 2021, 4:25pm UTC](https://discuss.elastic.co/t/unexpected-behaviour-for-auto-create-index/292487 "2021-12-20T16:25:42Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![hapeka](https://avatars.discourse-cdn.com/v4/letter/h/47e85d/32.png) [@hapeka](https://discuss.elastic.co/u/hapeka)\
**Post date:** [December 20, 2021, 4:25pm UTC](https://discuss.elastic.co/t/unexpected-behaviour-for-auto-create-index/292487/1 "2021-12-20T16:25:42Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [December 20, 2021, 4:38pm UTC](https://discuss.elastic.co/t/unexpected-behaviour-for-auto-create-index/292487/2 "2021-12-20T16:38:03Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [December 20, 2021, 5:13pm UTC](https://discuss.elastic.co/t/unexpected-behaviour-for-auto-create-index/292487/3 "2021-12-20T17:13:10Z")

</div>

Hmm I just test with my Elastic Cloud

```auto

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
}

```

---

<div class="post-metadata">

**Author:** ![hapeka](https://avatars.discourse-cdn.com/v4/letter/h/47e85d/32.png) [@hapeka](https://discuss.elastic.co/u/hapeka)\
**Post date:** [December 21, 2021, 7:55am UTC](https://discuss.elastic.co/t/unexpected-behaviour-for-auto-create-index/292487/4 "2021-12-21T07:55:42Z")

</div>

I have set the auto\_create\_index to false with the same command that you used.  
But I indexed the document with

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

```

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

---

<div class="post-metadata">

**Author:** ![hapeka](https://avatars.discourse-cdn.com/v4/letter/h/47e85d/32.png) [@hapeka](https://discuss.elastic.co/u/hapeka)\
**Post date:** [December 21, 2021, 8:15am UTC](https://discuss.elastic.co/t/unexpected-behaviour-for-auto-create-index/292487/5 "2021-12-21T08:15:53Z")

</div>

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](https://www.elastic.co/guide/en/elasticsearch/reference/current/transient-settings-migration-guide.html))

After running

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

```

it now works like expected (returning an error).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [January 18, 2022, 8:16am UTC](https://discuss.elastic.co/t/unexpected-behaviour-for-auto-create-index/292487/6 "2022-01-18T08:16:40Z")

</div>

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