Hello Experts,
I have created the ILM policy and applied to the index . but still it is not deleting the old file. is there anythin i miss or need to add. Please guide me.
PUT _ilm/policy/delete-old-indices
{
"policy": {
"phases": {
"hot": {
"min_age": "0ms",
"actions": {
"set_priority": {
"priority": 100
}
}
},
"delete": {
"min_age": "7d",
"actions": {
"delete": {
"delete_searchable_snapshot": true
}
}
}
}
}
}
and updated the template and index pattern
PUT tenant-*/_settings
{
"index": {
"lifecycle": {
"name": "delete-old-indices"
}
}
}
warkolm
(Mark Walkom)
April 25, 2023, 10:43pm
2
Can you share [an explain[(Explain lifecycle API | Elasticsearch Guide [8.7] | Elastic ) on one of the indices you think should have been deleted?
Hi Warkolm,
Thank you for the reply.
below is the output of GET tenant-demo-2023.02.10/_ilm/explain
{
"indices" : {
"tenant-demo-2023.02.10" : {
"index" : "tenant-demo-2023.02.10",
"managed" : true,
"policy" : "delete-old-indices",
"lifecycle_date_millis" : 1676031719373,
"age" : "74.65d",
"phase" : "hot",
"phase_time_millis" : 1682416154580,
"action" : "rollover",
"action_time_millis" : 1679643611758,
"step" : "check-rollover-ready",
"step_time_millis" : 1682416154580,
"is_auto_retryable_error" : true,
"failed_step_retry_count" : 2304,
"phase_execution" : {
"policy" : "delete-old-indices",
"phase_definition" : {
"min_age" : "0ms",
"actions" : {
"set_priority" : {
"priority" : 29
}
}
},
"version" : 2,
"modified_date_in_millis" : 1682415870237
}
}
}
}
elasticlog:
1682415870237
Can someone please help me to understand what exactly
The ILM policy ready which date to delete indices from below below.
"lifecycle_date_millis"
"phase_time_millis"
"action_time_millis"
"step_time_millis"
"modified_date_in_millis"
Hello @elasticlog
The numbers are epoch time format. as per your ILM explain output, indices which are 10th Feb dated will rollover to next phase after 74 days.
lifecycle_date_millis - February 10, 2023 5:51:59.373 PM GMT+05:30
phase_time_millis - April 25, 2023 3:19:14.580 PM GMT+05:30
action_time_millis - March 24, 2023 1:10:11.758 PM GMT+05:30
step_time_millis - April 25, 2023 3:19:14.580 PM GMT+05:30
However, you should also be mentioning warm phase as well in your polify. so, the flow should be hot, warm, delete.
For more information refer this elastic page.