# Indices are not deleteing using Lifecycle policy

**URL:** https://discuss.elastic.co/t/indices-are-not-deleteing-using-lifecycle-policy/306105
**Category:** Elasticsearch
**Tags:** ilm-index-lifecycle-management
**Created:** [June 1, 2022, 9:47am UTC](https://discuss.elastic.co/t/indices-are-not-deleteing-using-lifecycle-policy/306105 "2022-06-01T09:47:58Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![santosh\_rout](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/santosh_rout/32/106443_2.png) [@santosh\_rout](https://discuss.elastic.co/u/santosh_rout)
#### Post date: [June 1, 2022, 9:47am UTC](https://discuss.elastic.co/t/indices-are-not-deleteing-using-lifecycle-policy/306105/1 "2022-06-01T09:47:59Z")

</div>

In elastic 7.12, I have tried through kibana gui but indices are not able to linked so I used these commands in cli but Indices are linked in kibana but not deleting so please help me on this?

#curl -u elastic: -XPUT -sk ":9200/\_ilm/policy/central-container-accesslog\_policy" -H 'Content-Type: application/json' -d'{ "policy":{ "phases":{ "delete":{ "min\_age":"3d",  
"actions":{ "delete":{ } } } } }}' | jq .

#curl -u elastic: -XPUT -sk ":9200/\_template/central-container-accesslog\_template" -H 'Content-Type: application/json' -d'{ "index\_patterns":["central-caaslb01-logs-\*"], "settings":{ "number\_of\_shards":2, "number\_of\_replicas":1, "index.lifecycle.name":"central-container-accesslog\_policy" }}' | jq .

#curl -u elastic: -XPUT -sk ":9200/central-container-accesslog-index" -H 'Content-Type: application/json' -d'{ "settings":{ "number\_of\_shards":2, "number\_of\_replicas":1, "index.lifecycle.name":"central-container-accesslog\_policy" }}' | jq .

#curl -u elastic: -XGET -sk ":9200/\_ilm/policy/central-container-accesslog\_policy"

In Kibana:-  
PUT \_ilm/policy/central-container-accesslog\_policy  
{  
"policy": {  
"phases": {  
"hot": {  
"actions": {  
"set\_priority": {  
"priority": 100  
}  
},  
"min\_age": "0ms"  
},  
"delete": {  
"min\_age": "3d",  
"actions": {  
"delete": {  
"delete\_searchable\_snapshot": true  
}  
}  
}  
}  
}  
}

---

<div class="post-metadata">

### Author: ![ibra\_013](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ibra_013/32/104827_2.png) [@ibra\_013](https://discuss.elastic.co/u/ibra_013)
#### Post date: [June 1, 2022, 10:23am UTC](https://discuss.elastic.co/t/indices-are-not-deleteing-using-lifecycle-policy/306105/2 "2022-06-01T10:23:58Z")

</div>

Hi @santosh_rout

in order to check if the ILM policy is working run this API

```auto
GET <target>/_ilm/explain

```

> **[Explain lifecycle API | Elasticsearch Guide \[8.2\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-explain-lifecycle.html)**

---

<div class="post-metadata">

### Author: ![santosh\_rout](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/santosh_rout/32/106443_2.png) [@santosh\_rout](https://discuss.elastic.co/u/santosh_rout)
#### Post date: [June 1, 2022, 10:37am UTC](https://discuss.elastic.co/t/indices-are-not-deleteing-using-lifecycle-policy/306105/3 "2022-06-01T10:37:13Z")

</div>

Dear @ibra_013

Yes, its working. i can get so many indices using target as central-caaslb01-logs-\* but its showing "managed":false so how do i make as true ?

---

<div class="post-metadata">

### Author: ![santosh\_rout](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/santosh_rout/32/106443_2.png) [@santosh\_rout](https://discuss.elastic.co/u/santosh_rout)
#### Post date: [June 2, 2022, 9:59am UTC](https://discuss.elastic.co/t/indices-are-not-deleteing-using-lifecycle-policy/306105/4 "2022-06-02T09:59:52Z")

</div>

Dear @ibra_013

# [resource\_already\_exists\_exception when running tests] how to fix this issue?

PUT test-000001  
{  
"aliases": {  
"test-alias":{  
"is\_write\_index": true  
}  
}  
}

---

<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: [June 30, 2022, 10:00am UTC](https://discuss.elastic.co/t/indices-are-not-deleteing-using-lifecycle-policy/306105/5 "2022-06-30T10:00:00Z")

</div>

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