Delete old Elasticsearch Data Automatically

I want to delete old elasticserach data automatically. Is there any proper method to do it?

Can we delete those data within a preferred time period?

Index Lifecycle Management (ILM) seems to be the right feature for this.