# Why elasticsearch automatically creates an index if it has not been created before delete operation?

**URL:** <https://discuss.elastic.co/t/why-elasticsearch-automatically-creates-an-index-if-it-has-not-been-created-before-delete-operation/89867>\
**Category:** Elasticsearch\
**Created:** [June 19, 2017, 1:16am UTC](https://discuss.elastic.co/t/why-elasticsearch-automatically-creates-an-index-if-it-has-not-been-created-before-delete-operation/89867 "2017-06-19T01:16:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bourne](https://avatars.discourse-cdn.com/v4/letter/b/22d042/32.png) [@Bourne](https://discuss.elastic.co/u/Bourne)\
**Post date:** [June 19, 2017, 1:16am UTC](https://discuss.elastic.co/t/why-elasticsearch-automatically-creates-an-index-if-it-has-not-been-created-before-delete-operation/89867/1 "2017-06-19T01:16:10Z")

</div>

I have confused about the description about the delete API that the delete operation automatically creates an index if it has not been created before. But i tried to execute the delete an unexisting index operation, the elasticsearch response error directly and I didn't see that index has been created. Is there any one know this question. If it really works in that way,why did the delete operation create the index at first?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [June 19, 2017, 1:19am UTC](https://discuss.elastic.co/t/why-elasticsearch-automatically-creates-an-index-if-it-has-not-been-created-before-delete-operation/89867/2 "2017-06-19T01:19:30Z")

</div>

I just tried and it does not do this behaviour;

```auto
$ curl -XDELETE 0:9200/testindex
{"error":{"root_cause":[{"type":"index_not_found_exception","reason":"no such index","resource.type":"index_or_alias","resource.id":"testindex","index_uuid":"_na_","index":"testindex"}],"type":"index_not_found_exception","reason":"no such index","resource.type":"index_or_alias","resource.id":"testindex","index_uuid":"_na_","index":"testindex"},"status":404}

```

---

<div class="post-metadata">

**Author:** ![Bourne](https://avatars.discourse-cdn.com/v4/letter/b/22d042/32.png) [@Bourne](https://discuss.elastic.co/u/Bourne)\
**Post date:** [June 19, 2017, 2:30pm UTC](https://discuss.elastic.co/t/why-elasticsearch-automatically-creates-an-index-if-it-has-not-been-created-before-delete-operation/89867/4 "2017-06-19T14:30:54Z")

</div>

I tried to delete an unexisting index and got the same response as you,so I doubt about that description of official doc which as follows  
[https://www.elastic.co/guide/en/elasticsearch/reference/5.x/docs-delete.html#delete-index-creation](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/docs-delete.html#delete-index-creation)  
why delete an unexisting index will create it .It dosen't make any sense....

---

<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:** [July 17, 2017, 2:31pm UTC](https://discuss.elastic.co/t/why-elasticsearch-automatically-creates-an-index-if-it-has-not-been-created-before-delete-operation/89867/5 "2017-07-17T14:31:01Z")

</div>

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