ILM - How to configure to delete indexes older than 24 hours?

Hello,

I have indexes getting generated from logstash in below format :

indexname-yyyy-mm-dd and so on...

I want to set up index lifecycle management so that index older than a day gets deleted. How to achieve that ? I used ILM in kibana to setup a policy to activate delete phase for 24 hours. But the thing is I have to assign this policy to every single indexes manually like indexname-2019-10-10, indexname-2019-10-09, indexname-2019-10-08 etc To all these indexes I have to assign this policy manually. I mean whats the use then, I can just delete the older indexes manually.

You will want to update your index template which is responsible for managing the settings/mappings of those rolling indices to include the index.lifecycle.name.

https://www.elastic.co/guide/en/elasticsearch/reference/7.4/getting-started-index-lifecycle-management.html