I have created an index template in Elasticsearch, here are my settings
Index pattern
job_temp*
Priority
None
Component templates
None
Data stream
No
Version
None
{
"template": {
"settings": {
"index": {
"lifecycle": {
"name": "preview_policy"
},
"number_of_shards": "1",
"number_of_replicas": "0"
}
},
"aliases": {
"preview": {}
},
"mappings": {}
}
}
After that I had created an index lifecycle policy, which automatically should delete these indices after 30 minutes,
PUT _ilm/policy/preview_policy
{
"policy": {
"phases": {
"hot": {
"min_age": "0ms",
"actions": {
"rollover": {
"max_age": "30d",
"max_primary_shard_size": "50gb"
},
"set_priority": {
"priority": 100
}
}
},
"delete": {
"min_age": "30m",
"actions": {
"delete": {
"delete_searchable_snapshot": true
}
}
}
}
}
}
Then I created an index with pattern job_temp_762226, so according to my setting I was hoping it gets deleted after 30mins but instead I am getting this below error,
What am I missing here in order to make this work?
java.lang.IllegalArgumentException: setting [index.lifecycle.rollover_alias] for index [job_temp_762226] is empty or not defined
at org.elasticsearch.xpack.core.ilm.WaitForRolloverReadyStep.evaluateCondition(WaitForRolloverReadyStep.java:77)
at org.elasticsearch.xpack.ilm.IndexLifecycleRunner.runPeriodicStep(IndexLifecycleRunner.java:176)
at org.elasticsearch.xpack.ilm.IndexLifecycleService.triggerPolicies(IndexLifecycleService.java:333)
at org.elasticsearch.xpack.ilm.IndexLifecycleService.triggered(IndexLifecycleService.java:271)
at org.elasticsearch.xpack.core.scheduler.SchedulerEngine.notifyListeners(SchedulerEngine.java:184)
at org.elasticsearch.xpack.core.scheduler.SchedulerEngine$ActiveSchedule.run(SchedulerEngine.java:217)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
at java.base/java.lang.Thread.run(Thread.java:831)