Elasticsearch take snapshot then clean indices which older than 7 days

I have Elasticsearch 7.4.1 cluster for storing logs, and i have this SLM pattern applied in my cluster

curl -X PUT "afghanistan-01.elastic:9200/_slm/policy/nightly-snapshots?pretty" -H 'Content-Type: application/json' -d'
{
  "schedule": "0 30 1 * * ?", 
  "name": "<nightly-snap-{now/d}>", 
  "repository": "backup_repository",
  "config": { 
    "indices": ["*"] 
  }
}

so this SLM takes snapshot daily at 01:30 AM. And i want to delete indices which is older than 7 days after the successful snapshot completion so is there any way to do that using the policies? i know how to do it using Bash, but i think it's better to use internal mechanism to do this

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