# What is the best procedure to delete indices?

**URL:** <https://discuss.elastic.co/t/what-is-the-best-procedure-to-delete-indices/351778>\
**Category:** Elasticsearch\
**Tags:** docker\
**Created:** [January 25, 2024, 8:34am UTC](https://discuss.elastic.co/t/what-is-the-best-procedure-to-delete-indices/351778 "2024-01-25T08:34:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![7a6b6f](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/7a6b6f/32/118074_2.png) [@7a6b6f](https://discuss.elastic.co/u/7a6b6f)\
**Post date:** [January 25, 2024, 8:34am UTC](https://discuss.elastic.co/t/what-is-the-best-procedure-to-delete-indices/351778/1 "2024-01-25T08:34:38Z")

</div>

Hello everyone,

I have a question regarding the deletion of indices in an ELK (Elasticsearch, Logstash, Kibana) Docker-compose stack. Specifically, I would like to know the recommended procedure for deleting indices, and whether it is necessary to pause or stop the containers before executing the `curl -XDELETE` command.

Currently, I am using the following command to delete indices:

`curl -XDELETE http://localhost:9200/logs-2023*`

**Questions:**

**1]** Is this the correct approach, and should I stop or pause the containers before running this command to avoid any potential issues?

**2]** Then in addition, I would like to verify if the logs from 2023 will no longer appear in Kibana. Can anyone confirm this?

Any insights or best practices would be greatly appreciated.

Thank you!

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [January 25, 2024, 8:41am UTC](https://discuss.elastic.co/t/what-is-the-best-procedure-to-delete-indices/351778/2 "2024-01-25T08:41:25Z")

</div>

> [@7a6b6f](#):
>
> **1]** Is this the correct approach, and should I stop or pause the containers before running this command to avoid any potential issues?

Yes, this is the correct approach. This must be run on an active cluster, so do not stop anything. This is perfectly safe and there are no issues.

> [@7a6b6f](#):
>
> **2]** Then in addition, I would like to verify if the logs from 2023 will no longer appear in Kibana. Can anyone confirm this?

Assuming the indices contain the correct data, deleting indices will mean the data no longer is available in Elasticsearch and Kibana.

---

<div class="post-metadata">

**Author:** ![7a6b6f](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/7a6b6f/32/118074_2.png) [@7a6b6f](https://discuss.elastic.co/u/7a6b6f)\
**Post date:** [February 2, 2024, 3:17pm UTC](https://discuss.elastic.co/t/what-is-the-best-procedure-to-delete-indices/351778/3 "2024-02-02T15:17:38Z")

</div>

Thank you so much for your prompt reply, amazing !

So I tried to delete the indices, started with one to delete and it works fine, then I tried to delete from a specific month but it failed.

I had to do this step inside Kibana \> DevTools:

```auto
PUT /_cluster/settings
{
    "persistent" : {
      "action.destructive_requires_name": false
    }
}

```

Finally, I executed the curl delete command again with **logs-2023-02-** \* to remove the indices from February 2023 and it was working fine.

Again, thank you for you help Christian.

---

<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 1, 2024, 3:18pm UTC](https://discuss.elastic.co/t/what-is-the-best-procedure-to-delete-indices/351778/4 "2024-03-01T15:18:14Z")

</div>

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