# Policy for delete indices

**URL:** https://forum.opensearch.org/t/policy-for-delete-indices/14291
**Category:** Index Management
**Tags:** troubleshoot
**Created:** [May 10, 2023, 12:52pm UTC](https://forum.opensearch.org/t/policy-for-delete-indices/14291 "2023-05-10T12:52:30Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![taltsafrir](https://avatars.discourse-cdn.com/v4/letter/t/a698b9/32.png) [@taltsafrir](https://forum.opensearch.org/u/taltsafrir)
#### Post date: [May 10, 2023, 12:52pm UTC](https://forum.opensearch.org/t/policy-for-delete-indices/14291/1 "2023-05-10T12:52:30Z")

</div>

hi 🙂 how can I run policy every hour to delete indices that are older than a week?  
I did this just to delete after a week but I want this to run every hour:  
{  
“policy”: {  
“description”: “Delete Indices after 7 days.”,  
“default\_state”: “default”,  
“states”: [  
{  
“name”: “default”,  
“actions”: ,  
“transitions”: [  
{  
“state\_name”: “delete”,  
“conditions”: {  
“min\_index\_age”: “7d”  
}  
}  
]  
},  
{  
“name”: “delete”,  
“actions”: [  
{  
“delete”: {}  
}  
],  
“transitions”:   
}  
],  
“ism\_template”: [  
{  
“index\_patterns”: [  
“index-\*”  
],  
“priority”: 100  
}  
]  
}  
}

---

<div class="post-metadata">

### Author: ![Gsmitt](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/gsmitt/32/1718_2.png) [@Gsmitt](https://forum.opensearch.org/u/Gsmitt)
#### Post date: [May 10, 2023, 11:41pm UTC](https://forum.opensearch.org/t/policy-for-delete-indices/14291/2 "2023-05-10T23:41:59Z")

</div>

Hey @taltsafrir

> [@taltsafrir](#):
>
> I did this just to delete after a week but I want this to run every hour:

I dont under stand why you want to run it every hour, If it delete index set after 7 Days.

---

<div class="post-metadata">

### Author: ![radu.gheorghe](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/radu.gheorghe/32/3516_2.png) [@radu.gheorghe](https://forum.opensearch.org/u/radu.gheorghe)
#### Post date: [May 11, 2023, 12:29pm UTC](https://forum.opensearch.org/t/policy-for-delete-indices/14291/3 "2023-05-11T12:29:29Z")

</div>

Maybe it’s about how often the job for checking should run? That defaults to 5 minutes, but it can be changed via `plugins.index_state_management.job_interval`, see [Settings - OpenSearch documentation](https://opensearch.org/docs/latest/im-plugin/ism/settings/)

---

<div class="post-metadata">

### Author: ![taltsafrir](https://avatars.discourse-cdn.com/v4/letter/t/a698b9/32.png) [@taltsafrir](https://forum.opensearch.org/u/taltsafrir)
#### Post date: [May 11, 2023, 12:46pm UTC](https://forum.opensearch.org/t/policy-for-delete-indices/14291/4 "2023-05-11T12:46:42Z")

</div>

yes I meant how often for checking should run 🙂  
thanks!

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex019/uploads/mauve_hedgehog/original/2X/3/33547ea01a5b12dcca2958411d3edd97ae2ea8c1.png) [@system](https://forum.opensearch.org/u/system)
#### Post date: [July 10, 2023, 12:47pm UTC](https://forum.opensearch.org/t/policy-for-delete-indices/14291/5 "2023-07-10T12:47:32Z")

</div>

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