# ILM policy for a index which only delets 30 days data without deleting the index please check the below policy is write or wrong?

**URL:** <https://discuss.elastic.co/t/ilm-policy-for-a-index-which-only-delets-30-days-data-without-deleting-the-index-please-check-the-below-policy-is-write-or-wrong/329022>\
**Category:** Kibana\
**Tags:** ilm-index-lifecycle-management\
**Created:** [March 31, 2023, 8:06am UTC](https://discuss.elastic.co/t/ilm-policy-for-a-index-which-only-delets-30-days-data-without-deleting-the-index-please-check-the-below-policy-is-write-or-wrong/329022 "2023-03-31T08:06:10Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bibhudutta\_Mohanty](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bibhudutta_mohanty/32/119261_2.png) [@Bibhudutta\_Mohanty](https://discuss.elastic.co/u/Bibhudutta_Mohanty)\
**Post date:** [March 31, 2023, 8:06am UTC](https://discuss.elastic.co/t/ilm-policy-for-a-index-which-only-delets-30-days-data-without-deleting-the-index-please-check-the-below-policy-is-write-or-wrong/329022/1 "2023-03-31T08:06:10Z")

</div>

please any one can check the code is write according to this situation  
PUT \_ilm/policy/my\_policy  
{  
"policy": {  
"phases": {  
"hot": {  
"actions": {  
"rollover": {  
"max\_age": "30d"  
}  
}  
},  
"delete": {  
"min\_age": "30d",  
"actions": {  
"delete": {}  
}  
}  
}  
}  
Provide a index pattern to the index  
PUT my\_index  
{  
"settings": {  
"index.lifecycle.name": "my\_policy"  
}  
}  
its only contain 2 stages hot and delete

---

<div class="post-metadata">

**Author:** ![Tre\_Seymour](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tre_seymour/32/46507_2.png) [@Tre\_Seymour](https://discuss.elastic.co/u/Tre_Seymour)\
**Post date:** [March 31, 2023, 11:07am UTC](https://discuss.elastic.co/t/ilm-policy-for-a-index-which-only-delets-30-days-data-without-deleting-the-index-please-check-the-below-policy-is-write-or-wrong/329022/2 "2023-03-31T11:07:59Z")

</div>

Hello there @Bibhudutta_Mohanty  
I'll try this too.  
What versions of elastic and kibana are you running?

Am I correct in thinking that you wish to keep using the same index and completely remove the data older than 30 days?

I usually (for metrics data) use a data stream instead of a regular index. If you are not using metrics data, then pls disregard. With a data stream and ILM policy you'd we essentially writing to an alias (so to speak) and then the policy will automatically create the backing indices for you. In fact, I normally dont need to know the backing indice names.

[Data streams | Elasticsearch Guide [7.13] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/7.13/data-streams.html)

---

<div class="post-metadata">

**Author:** ![Bibhudutta\_Mohanty](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bibhudutta_mohanty/32/119261_2.png) [@Bibhudutta\_Mohanty](https://discuss.elastic.co/u/Bibhudutta_Mohanty)\
**Post date:** [April 3, 2023, 2:45pm UTC](https://discuss.elastic.co/t/ilm-policy-for-a-index-which-only-delets-30-days-data-without-deleting-the-index-please-check-the-below-policy-is-write-or-wrong/329022/3 "2023-04-03T14:45:00Z")

</div>

Hi Tre\_Seymour,

"version" : {  
"distribution" : "opensearch",  
"number" : "2.4.1",  
"build\_type" : "tar"

yes your assumption is right, wish to keep using the same index and completely remove the data older than 30 days. its a timeseries log data so i need a proper ilm policy which can delete only 30 days old log data without deleting the index.

i want your suggestion if i need one rollover policy?

---

<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:** [April 3, 2023, 2:45pm UTC](https://discuss.elastic.co/t/ilm-policy-for-a-index-which-only-delets-30-days-data-without-deleting-the-index-please-check-the-below-policy-is-write-or-wrong/329022/4 "2023-04-03T14:45:00Z")

</div>

OpenSearch/OpenDistro are AWS run products and differ from the original Elasticsearch and Kibana products that Elastic builds and maintains. You may need to contact them directly for further assistance.

(This is an automated response from your friendly Elastic bot. Please report this post if you have any suggestions or concerns :elasticheart: )

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [April 3, 2023, 9:51pm UTC](https://discuss.elastic.co/t/ilm-policy-for-a-index-which-only-delets-30-days-data-without-deleting-the-index-please-check-the-below-policy-is-write-or-wrong/329022/5 "2023-04-03T21:51:46Z")

</div>

ILM is an Elasticsearch only feature, you will need to ask aws directly what opensearch uses there.

---

<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:** [May 1, 2023, 9:52pm UTC](https://discuss.elastic.co/t/ilm-policy-for-a-index-which-only-delets-30-days-data-without-deleting-the-index-please-check-the-below-policy-is-write-or-wrong/329022/6 "2023-05-01T21:52:09Z")

</div>

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