# Can I delete deprecation log indices by a query?

**URL:** <https://discuss.elastic.co/t/can-i-delete-deprecation-log-indices-by-a-query/307253>\
**Category:** Elastic en Español\
**Created:** [June 15, 2022, 10:34am UTC](https://discuss.elastic.co/t/can-i-delete-deprecation-log-indices-by-a-query/307253 "2022-06-15T10:34:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![fujita](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fujita/32/107058_2.png) [@fujita](https://discuss.elastic.co/u/fujita)\
**Post date:** [June 15, 2022, 10:34am UTC](https://discuss.elastic.co/t/can-i-delete-deprecation-log-indices-by-a-query/307253/1 "2022-06-15T10:34:28Z")

</div>

Thank you for always providing useful information.  
Several days ago we upgraded Elasticsearch to version 7.17.2 at our data center.  
After upgrading we found that cluster health is yellow. Before upgrading it was not  
so. We invetigated the cause. We found that replica shars of deprecation log indices  
were assined when primary shars were created though our cluster is single.  
We set the "number\_of\_replicas" to "0" in the definition of the template and created  
indices and then cluster health became green.  
But now the number of deprecation log indices is 11. We confirmed .deprecation-indexing-ilm-policy and the attribute "Maximum age" is 14. If we execute a query to get the count of data in the index, responce will be 0 except for the latest index. The size of shar is default. We want to free tha space not used. Is it okay to drop the deprecation log index whose count of the data is 0 by the query such as "curl -u elastic -XDELETE '[http://localhost:9200/[index\_name]](http://localhost:9200/%5Bindex_name%5D)'?  
Thank you.

---

<div class="post-metadata">

**Author:** ![fujita](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fujita/32/107058_2.png) [@fujita](https://discuss.elastic.co/u/fujita)\
**Post date:** [June 17, 2022, 8:55am UTC](https://discuss.elastic.co/t/can-i-delete-deprecation-log-indices-by-a-query/307253/2 "2022-06-17T08:55:10Z")

</div>

I found the solution by myself. I didn't understand ILM. As an index such as .ds-.logs-deprecation.Elasticsearch-default-2022.MM.DD-0000XX  
is managed by the policy ".deprecation-indexing-ilm-policy". I confirmed the definition of it. Though the hot phase is specified, the delete  
phase is not specified. So I added the delete phase to the policy. After that all indices that had existed over the "min\_age" of the delete  
phase were deleted without error. Thanks to those who have seen my question.

---

<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 15, 2022, 8:55am UTC](https://discuss.elastic.co/t/can-i-delete-deprecation-log-indices-by-a-query/307253/3 "2022-07-15T08:55:22Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Janko](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/janko/32/26896_2.png) [@Janko](https://discuss.elastic.co/u/Janko)\
**Post date:** [November 25, 2022, 6:29pm UTC](https://discuss.elastic.co/t/can-i-delete-deprecation-log-indices-by-a-query/307253/4 "2022-11-25T18:29:48Z")

</div>

Welcome to the forum and thanks a lot for the follow-up @fujita and sharing the solution you found with others! 🙂

This post was made in the Spanish speaking part of the forum and hence was not seen by as many people over here.
