A snapshot retention policy controls how long automated snapshots remain available. For example, nightly backups of movie indexes can be retained for one week before expiration. section 14.4.6
Within snapshot lifecycle management, the retention setting works with a schedule, repository, and selected indexes. The policy is stored in the cluster and runs when its schedule triggers. section 14.4.6
Keep nightly snapshots for seven days
Set the retention value to "7d" in an SLM policy that backs up indexes matching "*movies*" and "*reviews*". A midnight schedule creates a new dated snapshot each night; expired snapshots are governed by the seven-day setting. section 14.4.6
Listing 14.11 Creating a policy for scheduled snapshots
PUT _slm/policy/prod_cluster_daily_backups #1
{
"name":"<prod_daily_backups-{now/d}>", #2
"schedule": "0 0 0 * * ?", #3
"repository": "es_cluster_snapshot_repository", #4
"config": {
"indices":["*movies*", "*reviews*"], #5
"include_global_state": false #6
},
"retention":{
"Expire_after":"7d" #7
}
}
Inspect the complete _slm policy request, including the repository, selected indexes, schedule, and retention configuration. section 14.4.6









