# How to use ISM to delete indexes by index pattern and age?

**URL:** <https://forum.opensearch.org/t/how-to-use-ism-to-delete-indexes-by-index-pattern-and-age/19868>\
**Category:** OpenSearch\
**Created:** [June 17, 2024, 1:11pm UTC](https://forum.opensearch.org/t/how-to-use-ism-to-delete-indexes-by-index-pattern-and-age/19868 "2024-06-17T13:11:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![McJava1967](https://avatars.discourse-cdn.com/v4/letter/m/a9a28c/32.png) [@McJava1967](https://forum.opensearch.org/u/McJava1967)\
**Post date:** [June 17, 2024, 1:11pm UTC](https://forum.opensearch.org/t/how-to-use-ism-to-delete-indexes-by-index-pattern-and-age/19868/1 "2024-06-17T13:11:20Z")

</div>

Hi all. I’m trying to use OpenSearch 2.12 ISM to delete indexes by index pattern and age. I’ve tried following the documentation ([https://opensearch.org/docs/2.12/im-plugin/ism/index/](https://opensearch.org/docs/2.12/im-plugin/ism/index/)), but no luck. Could anybody tell me what I’m doing wrong? This is my setup:

 ![image](https://us1.discourse-cdn.com/flex019/uploads/mauve_hedgehog/original/2X/a/a367615e6b1e961693dfc81923884bad23585de9.png)

The older\_than\_one\_day State is:

```auto
Destination state
delete
Transition trigger logic
Minimum index age is 1d

```

And the Delete state has only a Delete Action.

I would expect to see any indexes beginning with test-_, heartbeat-_ or dev-\* deleted after one day. But nothing happens. For instance, I still see indexes like **test-lex-nam-sea-knams-2024.06.13** , after this has been running for several days.

Could anybody help? HELP!

🙂

---

<div class="post-metadata">

**Author:** ![gaobinlong](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/gaobinlong/32/5242_2.png) [@gaobinlong](https://forum.opensearch.org/u/gaobinlong)\
**Post date:** [June 18, 2024, 6:02am UTC](https://forum.opensearch.org/t/how-to-use-ism-to-delete-indexes-by-index-pattern-and-age/19868/2 "2024-06-18T06:02:41Z")

</div>

Did you see the index `test-lex-nam-sea-knams-2024.06.13` in the page of `Policy managed indexes`? What’s the status of the policy execution on that index?

 ![image](https://us1.discourse-cdn.com/flex019/uploads/mauve_hedgehog/original/2X/3/35435d4e31280505eaa8cd0c6e5a7e631afb16e2.png)

---

<div class="post-metadata">

**Author:** ![McJava1967](https://avatars.discourse-cdn.com/v4/letter/m/a9a28c/32.png) [@McJava1967](https://forum.opensearch.org/u/McJava1967)\
**Post date:** [June 18, 2024, 12:57pm UTC](https://forum.opensearch.org/t/how-to-use-ism-to-delete-indexes-by-index-pattern-and-age/19868/3 "2024-06-18T12:57:21Z")

</div>

Ah! I don’t see that one. But I DO now see it IS working. It must have been my initial confusion setting this up that missed the 06-13 index. But I can see other, more recent, indexes are now getting deleted.

Thank you for your help!

🙂
