# Delete Indices/index/documents but 404 NotFound

**URL:** <https://discuss.elastic.co/t/delete-indices-index-documents-but-404-notfound/351250>\
**Category:** Elasticsearch\
**Created:** [January 17, 2024, 9:56am UTC](https://discuss.elastic.co/t/delete-indices-index-documents-but-404-notfound/351250 "2024-01-17T09:56:28Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![martel](https://avatars.discourse-cdn.com/v4/letter/m/b77776/32.png) [@martel](https://discuss.elastic.co/u/martel)\
**Post date:** [January 17, 2024, 9:56am UTC](https://discuss.elastic.co/t/delete-indices-index-documents-but-404-notfound/351250/1 "2024-01-17T09:56:28Z")

</div>

Hey,  
I want delete all indices, document, but want keep Template index.  
i have already try many operations see here in forum, but nothing clean my path data.

A) \_settings with index.blocks.read\_only\_allow\_delete and index.blocks.read\_only for all \_index  
**OK**  
B) \_bulk?pretty with { "delete" : { "\_index" : ".ds-xxxx-filebeat-8.4.2-2023.03.08-2024.01.16-000001", "\_id" : "a6ePqeckT0mnCacor\_SGOg" } }  
i receive status 404 not found.

my folder data is allways 225Giga on two nodes... why ?

thanks.  
Good day

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [January 17, 2024, 10:00am UTC](https://discuss.elastic.co/t/delete-indices-index-documents-but-404-notfound/351250/2 "2024-01-17T10:00:31Z")

</div>

Normally you should use: [Delete index API | Elasticsearch Guide [8.11] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-delete-index.html)

What is the output of:

```auto
GET /
GET /_cat/indices?v

```

---

<div class="post-metadata">

**Author:** ![yago82](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yago82/32/97755_2.png) [@yago82](https://discuss.elastic.co/u/yago82)\
**Post date:** [January 17, 2024, 10:59am UTC](https://discuss.elastic.co/t/delete-indices-index-documents-but-404-notfound/351250/3 "2024-01-17T10:59:09Z")

</div>

Hi,

To delete all indices, you can use the following command:

```auto
DELETE /_all

```

> **[Delete index API | Elasticsearch Guide \[8.11\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/8.11/indices-delete-index.html)**

Regards

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [January 17, 2024, 11:20am UTC](https://discuss.elastic.co/t/delete-indices-index-documents-but-404-notfound/351250/4 "2024-01-17T11:20:04Z")

</div>

But note that:

> By default, this parameter does not support wildcards (`*` ) or `_all` . To use wildcards or `_all` , set the [`action.destructive_requires_name`](https://www.elastic.co/guide/en/elasticsearch/reference/8.11/index-management-settings.html#action-destructive-requires-name) cluster setting to `false` .

---

<div class="post-metadata">

**Author:** ![martel](https://avatars.discourse-cdn.com/v4/letter/m/b77776/32.png) [@martel](https://discuss.elastic.co/u/martel)\
**Post date:** [January 17, 2024, 12:28pm UTC](https://discuss.elastic.co/t/delete-indices-index-documents-but-404-notfound/351250/5 "2024-01-17T12:28:56Z")

</div>

OK, I did it in two steps in CURL:  
the first for each clue that I wanted to erase:

> \_settings?pretty  
> -H 'Content-Type: application/json' -d'  
> { "index.blocks.read\_only\_allow\_delete": null, "index.blocks.read\_only": false }  
> '

the second for each clue that I wanted to erase:

> \_delete\_by\_query -H 'Content-Type: application/json' -d'{ "query": { "match\_all": {} }}'

result: the deletion is successful, I have my /data directory which has decreased.  
I come back to kibana, and I see an old index coming back that I had deleted... am I missing something?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [January 17, 2024, 12:41pm UTC](https://discuss.elastic.co/t/delete-indices-index-documents-but-404-notfound/351250/6 "2024-01-17T12:41:48Z")

</div>

OMG! You deleted the documents not the index.  
It's better to delete the index.

> [@martel](#):
>
> and I see an old index coming back that I had deleted

What do you mean?

The index still exists indeed. But you should probably not see any content anymore.

---

<div class="post-metadata">

**Author:** ![martel](https://avatars.discourse-cdn.com/v4/letter/m/b77776/32.png) [@martel](https://discuss.elastic.co/u/martel)\
**Post date:** [January 17, 2024, 12:50pm UTC](https://discuss.elastic.co/t/delete-indices-index-documents-but-404-notfound/351250/7 "2024-01-17T12:50:53Z")

</div>

i use streamData, when i go kibana [Index Management] -\> Indices  
or [Index Management] -\> Data Streams  
Delete all i want, but... back after some secondes....

---

<div class="post-metadata">

**Author:** ![martel](https://avatars.discourse-cdn.com/v4/letter/m/b77776/32.png) [@martel](https://discuss.elastic.co/u/martel)\
**Post date:** [January 17, 2024, 12:52pm UTC](https://discuss.elastic.co/t/delete-indices-index-documents-but-404-notfound/351250/8 "2024-01-17T12:52:14Z")

</div>

i want delete the data Stream [March 30th, 2023 3:14:03 PM] but is back after ....

---

<div class="post-metadata">

**Author:** ![martel](https://avatars.discourse-cdn.com/v4/letter/m/b77776/32.png) [@martel](https://discuss.elastic.co/u/martel)\
**Post date:** [January 17, 2024, 12:54pm UTC](https://discuss.elastic.co/t/delete-indices-index-documents-but-404-notfound/351250/9 "2024-01-17T12:54:21Z")

</div>

my ILM policy for this data stream normaly is deleted after 24 Days.  
why i have 2023 30th March or other ?

---

<div class="post-metadata">

**Author:** ![yago82](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yago82/32/97755_2.png) [@yago82](https://discuss.elastic.co/u/yago82)\
**Post date:** [January 17, 2024, 12:57pm UTC](https://discuss.elastic.co/t/delete-indices-index-documents-but-404-notfound/351250/10 "2024-01-17T12:57:35Z")

</div>

Hi,

but you can't simple delete this datastream from Kibana gui?

Regards

---

<div class="post-metadata">

**Author:** ![martel](https://avatars.discourse-cdn.com/v4/letter/m/b77776/32.png) [@martel](https://discuss.elastic.co/u/martel)\
**Post date:** [January 17, 2024, 12:59pm UTC](https://discuss.elastic.co/t/delete-indices-index-documents-but-404-notfound/351250/11 "2024-01-17T12:59:24Z")

</div>

thanks you, lol i do that until yesterday...

---

<div class="post-metadata">

**Author:** ![martel](https://avatars.discourse-cdn.com/v4/letter/m/b77776/32.png) [@martel](https://discuss.elastic.co/u/martel)\
**Post date:** [January 17, 2024, 1:00pm UTC](https://discuss.elastic.co/t/delete-indices-index-documents-but-404-notfound/351250/12 "2024-01-17T13:00:09Z")

</div>

i try now to see on filebeat, perhaps it cosume old file log.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [January 17, 2024, 1:36pm UTC](https://discuss.elastic.co/t/delete-indices-index-documents-but-404-notfound/351250/13 "2024-01-17T13:36:34Z")

</div>

It probably means that you did not stop the tools which are sending data to Elasticsearch, like filebeat, elastic agent....

---

<div class="post-metadata">

**Author:** ![martel](https://avatars.discourse-cdn.com/v4/letter/m/b77776/32.png) [@martel](https://discuss.elastic.co/u/martel)\
**Post date:** [January 17, 2024, 1:42pm UTC](https://discuss.elastic.co/t/delete-indices-index-documents-but-404-notfound/351250/14 "2024-01-17T13:42:57Z")

</div>

i have put :  
ignore\_older: 48h

on file filebeat input.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [January 17, 2024, 2:15pm UTC](https://discuss.elastic.co/t/delete-indices-index-documents-but-404-notfound/351250/15 "2024-01-17T14:15:27Z")

</div>

But did you stop filebeat?

I mean that first stop filebeat. If no data is coming again, then the problem is solved.

If you have a problem with filebeat configuration, I'd suggest to open a new discussion in #Beats with the #filebeat tag.

---

<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:** [February 14, 2024, 2:15pm UTC](https://discuss.elastic.co/t/delete-indices-index-documents-but-404-notfound/351250/16 "2024-02-14T14:15:42Z")

</div>

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