# Resource already exists exception throws after delete the index and create it again immediately

**URL:** <https://discuss.elastic.co/t/resource-already-exists-exception-throws-after-delete-the-index-and-create-it-again-immediately/169344>\
**Category:** Elasticsearch\
**Created:** [February 21, 2019, 7:50am UTC](https://discuss.elastic.co/t/resource-already-exists-exception-throws-after-delete-the-index-and-create-it-again-immediately/169344 "2019-02-21T07:50:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kunliu](https://avatars.discourse-cdn.com/v4/letter/k/e47c2d/32.png) [@kunliu](https://discuss.elastic.co/u/kunliu)\
**Post date:** [February 21, 2019, 7:50am UTC](https://discuss.elastic.co/t/resource-already-exists-exception-throws-after-delete-the-index-and-create-it-again-immediately/169344/1 "2019-02-21T07:50:26Z")

</div>

Hi Team,

I am experiencing an intermittent issue. If I delete an index and create it again immediately , ES will throws resource\_already\_exists\_exception:

[48258390003131ec/mrHqvHQFSXWktcONr3iigA] ElasticsearchStatusException[Elasticsearch exception [type=resource\_already\_exists\_exception, reason=index [48258390003131ec/mrHqvHQFSXWktcONr3iigA] already exists]]

I have code to check if index exists (by calling client.indices().exists) between the delete and create operation. I do create index only I got false from the call client.indices() . But sometime I still get resource\_already\_exists\_exception.

And I am using version 6.5.4 REST High Level client.

Any thoughts on this will be very appreciated.

---

<div class="post-metadata">

**Author:** ![kunliu](https://avatars.discourse-cdn.com/v4/letter/k/e47c2d/32.png) [@kunliu](https://discuss.elastic.co/u/kunliu)\
**Post date:** [February 21, 2019, 10:13am UTC](https://discuss.elastic.co/t/resource-already-exists-exception-throws-after-delete-the-index-and-create-it-again-immediately/169344/2 "2019-02-21T10:13:07Z")

</div>

I noticed the DeleteIndexRequest could set IndicesOptions as follow:

dReq.indicesOptions(IndicesOptions.strictExpand());

The question is if I don't set the IndicesOptions, what's the default value ?

---

<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:** [March 21, 2019, 10:17am UTC](https://discuss.elastic.co/t/resource-already-exists-exception-throws-after-delete-the-index-and-create-it-again-immediately/169344/3 "2019-03-21T10:17:49Z")

</div>

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