# Delete data stream and all it's index

**URL:** <https://discuss.elastic.co/t/delete-data-stream-and-all-its-index/340085>\
**Category:** Elasticsearch\
**Created:** [August 3, 2023, 10:46pm UTC](https://discuss.elastic.co/t/delete-data-stream-and-all-its-index/340085 "2023-08-03T22:46:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![elasticforme](https://avatars.discourse-cdn.com/v4/letter/e/f05b48/32.png) [@elasticforme](https://discuss.elastic.co/u/elasticforme)\
**Post date:** [August 3, 2023, 10:46pm UTC](https://discuss.elastic.co/t/delete-data-stream-and-all-its-index/340085/1 "2023-08-03T22:46:15Z")

</div>

I have a test data stream. it works fine. But now I am trying to delete it and I can't

When I do delete via command or via GUI it recreates it self

DELETE /\_data\_stream/msyos1-log

I can't delete index template as well. it gives me this error.  
and can not delete data stream as it recreats it self.

{  
"error": {  
"root\_cause": [  
{  
"type": "illegal\_argument\_exception",  
"reason": "unable to remove composable templates [msyos1-log] as they are in use by a data streams [msyos1-log]"  
}  
],  
"type": "illegal\_argument\_exception",  
"reason": "unable to remove composable templates [msyos1-log] as they are in use by a data streams [msyos1-log]"  
},  
"status": 400  
}

How do I delete them?

---

<div class="post-metadata">

**Author:** ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)\
**Post date:** [August 4, 2023, 2:53am UTC](https://discuss.elastic.co/t/delete-data-stream-and-all-its-index/340085/2 "2023-08-04T02:53:33Z")

</div>

> [@elasticforme](#):
>
> When I do delete via command or via GUI it recreates it self

How are you sending data to this data stream?

The only reason I can think for a data stream to be recreated after you delete is if you still have something sending data for it.

You need to stop the ingestion of data before you delete the data stream or it will be recreated.

---

<div class="post-metadata">

**Author:** ![elasticforme](https://avatars.discourse-cdn.com/v4/letter/e/f05b48/32.png) [@elasticforme](https://discuss.elastic.co/u/elasticforme)\
**Post date:** [August 4, 2023, 6:04pm UTC](https://discuss.elastic.co/t/delete-data-stream-and-all-its-index/340085/3 "2023-08-04T18:04:17Z")

</div>

no data is coming in. has zero record

---

<div class="post-metadata">

**Author:** ![elasticforme](https://avatars.discourse-cdn.com/v4/letter/e/f05b48/32.png) [@elasticforme](https://discuss.elastic.co/u/elasticforme)\
**Post date:** [August 7, 2023, 3:03pm UTC](https://discuss.elastic.co/t/delete-data-stream-and-all-its-index/340085/4 "2023-08-07T15:03:12Z")

</div>

you were right, client was sending data, it was failing because it does not had action = create and this is datastream which requires that step.

that app do not have such setting to add action=create. hence I had to use old way of creating ILM, template and alias and Index.

---

<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:** [September 4, 2023, 3:03pm UTC](https://discuss.elastic.co/t/delete-data-stream-and-all-its-index/340085/5 "2023-09-04T15:03:50Z")

</div>

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