Snapshot Lifecycle Management in Elasticsearch
How Elasticsearch takes backups on a schedule, keeps only the ones you need, and reports on its own health — explained from the ground up with analogies, diagrams, and real production thinking.
Picture a busy online shop at 3 PM on a Tuesday. A tired engineer runs a cleanup command meant for a test index, but a wildcard sneaks in and the live product-search index disappears. Customers see empty search results. Sales stop. The only question anyone cares about is: when was our last good backup, and how fast can we get it back?
In Elasticsearch, a backup is called a snapshot, and the built-in feature that creates snapshots on a schedule and deletes old ones automatically is called Snapshot Lifecycle Management, or SLM. This article walks through SLM piece by piece: what it is, how it works inside the cluster, how to design policies, how to keep them healthy, and how to avoid the mistakes that turn a comfortable backup plan into a nightmare on the worst day of the year.
Every new term is explained the first time it appears, with an everyday analogy and a real production example, so no prior Elasticsearch knowledge is assumed.
1What Is Snapshot Lifecycle Management?
SLM is the part of Elasticsearch that runs your backup routine for you: take snapshots on time, remove old ones by rule, and keep a record of what happened.
Start with the plain-English definition
Elasticsearch is a search and analytics engine. It stores information as JSON documents inside containers called indices. Each index is cut into smaller pieces called shards, and shards are spread across the machines (called nodes) that make up a cluster.
A snapshot is a saved copy of some of that data, plus optionally some cluster settings, written to a storage location outside the cluster. That location is called a repository — think of it as a vault that lives somewhere else, such as Amazon S3, Google Cloud Storage, Azure Blob Storage, or a shared network drive.
Snapshot Lifecycle Management adds two ideas on top of plain snapshots: a policy (a saved set of instructions describing what to back up, where, and how often) and retention (rules describing how long to keep the backups). Once a policy exists, the cluster wakes up on schedule, takes the snapshot, and later deletes snapshots that are too old.
Think of the automatic backup on your phone. You set it up once: back up every night, keep the last thirty days. After that, you stop thinking about it. The phone wakes up at night, copies what changed, and throws away copies that are too old. SLM is that same idea for an Elasticsearch cluster, with far more control over the details.
Why SLM exists
Before SLM shipped, teams wrote their own automation: a cron job on some server that called the snapshot API every night, plus a second script that deleted old snapshots. These scripts worked until the server was replaced, the script broke quietly, or the person who wrote it left the company. Nobody noticed until a restore was needed, and by then months of backups might be missing.
SLM moved this job inside the cluster itself. The schedule, the retention rules, and the success and failure history now live in cluster state, so they survive node replacements and are visible through the same tools already used to run Elasticsearch day to day. SLM first shipped in the Elasticsearch 7.x series and is a standard feature in current versions.
The three jobs of SLM
Schedule
At the times you choose, SLM creates a new snapshot with a unique name, using the repository and index selection defined in the policy.
Retain
A separate daily cleanup job deletes snapshots that are older than your limit or beyond your maximum count, while protecting a configured minimum.
Report
SLM records the last success, last failure, next planned run, and run counters for each policy, and can log history documents you can search.
A few numbers worth remembering
These are cluster-level defaults administrators can change. They resurface in later chapters, so it helps to meet them early.
The big picture
Here is the whole story in one diagram. A policy lives in cluster state. The elected master node — the single node currently acting as the cluster’s coordinator — runs the SLM scheduler. When the schedule fires, the master asks the relevant data nodes to copy their shard files into the repository. A separate retention job later removes old snapshots.
flowchart LR P["SLM Policy
schedule, scope, retention"] --> M["Elected Master Node
SLM scheduler"] M -->|"cron fires"| S["Snapshot Service"] S --> D1["Data Node 1"] S --> D2["Data Node 2"] S --> D3["Data Node 3"] D1 --> R[("Snapshot Repository
S3, GCS, Azure, shared FS")] D2 --> R D3 --> R M -->|"daily retention job"| R
Read the diagram left to right. The policy is only a set of instructions. The master node is the manager who reads those instructions. The data nodes are the workers who carry the boxes. The repository is the warehouse where the boxes are stored. The bottom arrow shows a second manager task: walking through the warehouse and removing boxes that are past their date.
What SLM does not do
SLM does not restore data by itself, does not back up node configuration files, keystores, or TLS certificates, and does not replace replicas. Replicas protect you from a machine dying. Snapshots protect you from mistakes, corruption, and disasters. Production clusters need both.
2Why Backups Matter: The Problem SLM Solves
Data loss rarely comes from one dramatic event. It comes from ordinary mistakes, ordinary bugs, and ordinary hardware, meeting a cluster with no recent backup.
Six ways data gets lost
Wrong command
A delete request with a wildcard, a misplaced index name, or a script pointed at production instead of staging.
Bad deploy
A new application version writes broken documents or overwrites good ones, and nobody notices for two days.
Upgrade trouble
A version upgrade or a mapping change goes wrong and the team needs to return to the state from before the change.
Zone or region outage
Several nodes vanish together because the wider infrastructure area they live in fails.
Attack or ransomware
Someone with access deletes or encrypts data on purpose, including data on every replica copy.
Silent damage
Disk or file-system faults damage shard files, and the damage can spread before anyone notices.
Replicas are not backups
Elasticsearch already keeps copies of every shard. A primary shard holds the main copy, and a replica shard holds another live copy on a different node. If a node dies, a replica takes over within seconds — this is called high availability, and it is genuinely valuable.
But a replica updates the instant the primary changes. If the primary is deleted, the replica is deleted too. If a bug writes garbage data, the replica receives the same garbage. A replica is a mirror, not a memory.
A mirror shows exactly what stands in front of it, right now. Spill paint on your shirt and the mirror shows the paint instantly. A photo album keeps how things looked last Tuesday. Replicas are the mirror. Snapshots are the photo album. When something goes wrong, the album is what saves you.
Two numbers every backup plan needs
Recovery Point Objective (RPO) answers: how much recent data can we afford to lose? If snapshots run every hour, the worst case is losing a little more than an hour of changes. Recovery Time Objective (RTO) answers: how long can the system stay down while restoring? Restoring a large cluster from object storage takes time proportional to its size, so RTO must be measured by testing, not guessed.
| Snapshot frequency | Worst-case data loss (RPO) | Typical fit |
|---|---|---|
| Every 30 minutes | About 30 minutes plus snapshot duration | Customer-facing search, order data |
| Hourly | About 1 hour plus snapshot duration | Important application indices |
| Daily | About 24 hours plus snapshot duration | Logs, analytics, reports that can be rebuilt |
| Weekly or monthly | Days to weeks | Long-term archive copies |
Why automation beats memory
Humans forget. Scripts break without telling anyone. A backup process depending on one person or one server is a backup process waiting to fail. SLM keeps its schedule inside the cluster, tracks every run, and can be watched by the same monitoring already used for everything else. It turns “someone should back this up” into “the cluster backs this up, and we get alerted if it stops.”
Elastic Cloud deployments come with automated snapshot protection enabled by default, using frequent snapshots into a managed repository. Companies such as Netflix and Uber have described Elasticsearch as a core part of their search and logging platforms in public engineering talks. At that scale, an automated, tested snapshot routine is treated as basic hygiene, not an optional extra.
A snapshot restores data to the exact moment it was taken. Anything written after that moment is gone unless another system, such as a message queue or the original source database, can replay it. Keep a source of truth outside Elasticsearch wherever possible.
3Snapshot Foundations: Repositories, Segments, and Incremental Copies
SLM only automates snapshots, so understanding what a snapshot contains, where it lives, and why the second one costs so much less than the first, makes everything else click.
What is inside a snapshot
A snapshot can contain three kinds of things. First, index data: the shard files for the indices selected. Second, the global state: cluster-wide items such as persistent settings, index templates, ingest pipelines, and lifecycle policies. Third, feature states: the internal system indices that features and tools such as Kibana and security keep for themselves.
The policy chooses which of these to include. A common pattern backs up business indices every hour without global state, and takes a separate, less frequent snapshot that includes global state so the cluster’s configuration can be rebuilt from scratch if needed.
The repository: your vault
Before any snapshot can run, a repository must be registered. This tells Elasticsearch which storage system to use and how to reach it. Registration also runs a verification step where every node checks that it can actually write to that location.
| Repository type | Where the data lives | Notes |
|---|---|---|
| Amazon S3 | An S3 bucket | Very common in production; S3 is designed for eleven nines (99.999999999%) of object durability. |
| Google Cloud Storage | A GCS bucket | Common for clusters running in Google Cloud. |
| Azure Blob Storage | An Azure container | Common for clusters running in Azure. |
| Shared file system | A network drive mounted at the same path on every node | Simple for small setups, but every node must see identical files. |
| Read-only URL | A web or file location | Used to read snapshots someone else wrote, never to write new ones. |
| Source-only | Any of the above, wrapped | Stores only the original documents, so it is smaller but slower to restore since indices must be rebuilt. |
Segments: the secret behind cheap snapshots
Inside each shard, Elasticsearch relies on a library called Lucene, which writes data into files called segments. The key rule: a segment is never changed after it is written. New documents go into new segments. Deleted documents are only marked as deleted. Periodically, small segments merge into larger new segments and the old ones are discarded.
This rule makes incremental backups almost free. When a snapshot runs, Elasticsearch checks which segment files already exist in the repository and copies only the ones missing. Everything else is simply referenced by pointer.
Imagine a library shelf where books are never edited, only added or removed. To back up the shelf each night, nobody photocopies every book again — only the new books get copied, alongside an updated list of which books belonged on the shelf that night. Each night’s list is a snapshot. The books are the segment files.
flowchart TD SA["Snapshot Monday"] --> F1["Segment file 1"] SA --> F2["Segment file 2"] SB["Snapshot Tuesday"] --> F1 SB --> F2 SB --> F3["Segment file 3, added Tuesday"] SC["Snapshot Wednesday"] --> F2 SC --> F3 SC --> F4["Segment file 4, added Wednesday"]
This picture explains two important behaviors. First, the repository grows by roughly the amount of changed data each time, not by the full index size — a 100 GB index that changes by 5 GB overnight adds about 5 GB to the next snapshot, not another 100 GB. Second, deleting a snapshot never removes a file another snapshot still needs. In the diagram, deleting Monday’s snapshot leaves file 1 in place because Tuesday still points at it; only once Tuesday is also deleted does file 1 become unused and get removed.
Point-in-time, but not perfectly simultaneous
A snapshot does not freeze the cluster. Indexing and searching continue while it runs. Each shard is captured as it looked at the moment that shard’s copy began. Shards starting a few seconds later may include a few seconds more data. Each shard is internally consistent, but the snapshot is not one perfectly synchronized instant across every shard.
The most important repository rule
Only one cluster should ever write to a given repository at a time. Two clusters writing to the same location can corrupt the repository’s internal bookkeeping. If a second cluster, such as a disaster-recovery cluster, needs to read the snapshots, register the repository there as read-only.
SLM cannot create the repository for you. Register and verify the repository first, then create the policy that points to it.
4Anatomy of an SLM Policy
A policy is a small saved recipe with five ingredients. Once each ingredient is understood, every policy anyone writes becomes easy to read.
A policy resembles a standing order at a bakery: deliver twelve rolls every morning at six, address them to the office, label each box with the date, and discard any box left unclaimed for a week. It is one recipe that repeats without further effort from anyone.
The five parts
Schedule
A cron expression stating when to take snapshots. It uses six fields starting with seconds, so 0 30 2 * * ? means every day at 02:30 UTC.
Name
A pattern for snapshot names, often using date math such as <nightly-{now/d}>. SLM appends a random suffix so two runs on the same day never clash.
Repository
The name of the already registered repository that will store the resulting snapshots.
Config
Which indices or data streams to include, whether to include global state, which feature states, and how to treat missing or unavailable data.
Retention
Optional rules: expire after an age, keep at least a minimum number, keep at most a maximum number.
Policy ID versus snapshot name
Newcomers often mix these two up. The policy ID is the permanent name of the policy itself, for example nightly-critical. The snapshot name is generated fresh at each run from the name pattern, for example nightly-2026.09.21-x7f3k9q. One policy produces many snapshots over its lifetime.
SLM also stamps each snapshot with metadata containing the policy ID. This stamp is how the retention job later knows which snapshots belong to which policy. Snapshots created manually, without the stamp, are never touched by SLM retention.
What the config section controls
| Option | What it means | Default behavior |
|---|---|---|
indices | Which indices, data streams, or wildcard patterns to include | All indices and data streams if unset |
include_global_state | Include cluster-wide settings, templates, and similar items | True |
feature_states | Which system feature data, such as Kibana or security, to include | Follows the global state choice |
ignore_unavailable | Skip missing or closed indices instead of failing | False, so a missing index causes failure |
partial | Allow a snapshot to finish even if some primary shards are unavailable | False, so it fails instead of completing incompletely |
metadata | Free-form labels, such as team or environment | None |
A policy explained in words
Suppose a team writes a policy called nightly-critical. Its schedule fires at 02:00 UTC every day. Its repository is a bucket reserved for production backups. Its config includes the orders-* and customers-* indices and leaves out global state. Its retention says expire after 30 days, always keep at least 7 snapshots, and never keep more than 60.
Every night the cluster creates a fresh snapshot of those indices. The next morning’s retention job — which runs on its own schedule, not at 02:00 — scans all snapshots stamped nightly-critical and removes those that break the rules. The team touches nothing after setup.
Give policy IDs meaning: purpose plus frequency, such as hourly-orders or weekly-global-state. When an alert fires at night, a clear name saves precious minutes of confusion.
Current versions enforce a minimum gap between runs of the same policy, 15 minutes by default. Even without that guard, avoid scheduling runs more often than one snapshot can finish, or snapshots pile up and compete for the same disks and network bandwidth.
5Internal Working: What Happens When a Policy Fires
Following one policy run from the scheduled second to the finished snapshot shows exactly which cluster components talk to each other and in what order.
Step by step
The scheduler wakes up
The elected master node runs an internal clock that checks every policy’s cron schedule. When one matches the current time, SLM begins a run for that policy.
A snapshot name is generated
The name pattern is rendered with the current date and time, then a random suffix is added to guarantee uniqueness even if two runs somehow overlap.
The snapshot request is submitted
SLM calls the same create-snapshot API a person would call by hand, passing the repository, indices, and configuration from the policy, plus the policy-ID metadata stamp.
Each primary shard is copied
For every included index, the primary copy of each shard is read. New segment files are streamed to the repository; unchanged segment files are simply referenced.
A manifest is written
Once every shard finishes, a snapshot manifest is written listing exactly which files make up this snapshot. The snapshot only becomes visible and restorable once this manifest exists.
The result is recorded
SLM stores the outcome — success or failure, along with the snapshot name and timestamp — in the policy’s own status, visible through the get-policy API.
sequenceDiagram participant C as Cron Scheduler participant M as Master Node participant D as Data Nodes participant Repo as Repository C->>M: Schedule matches now M->>M: Generate snapshot name M->>D: Create snapshot request D->>Repo: Upload new segment files D->>M: Shard snapshot complete M->>Repo: Write snapshot manifest M->>M: Record success in policy status
Why only the master schedules, but any node can copy
Elasticsearch avoids two nodes trying to run the same scheduled job at once by giving scheduling duties to the single elected master node at any moment. If that master fails mid-run, a newly elected master takes over SLM’s bookkeeping using the same cluster state, so a policy is never silently lost, though an in-flight snapshot at the moment of failover may need to be retried.
Copying the actual shard data, however, is spread across every relevant data node, since each node holds a different slice of the index. This keeps a snapshot from becoming a single-node bottleneck.
What “success” really means
A snapshot can finish in a PARTIAL state if some shards could not be copied, typically because they were unavailable at that moment. Unless the policy explicitly allows partial snapshots, this state is treated as a failure for retention and alerting purposes, and rightly so — a backup missing some shards is not a backup you can safely trust.
6Data Flow and the Snapshot Lifecycle End to End
Zooming out from one run to the whole lifecycle shows how creation, listing, restoring, and deletion fit together as one continuous flow.
The four lifecycle stages
Creation
SLM triggers a snapshot on schedule, or an operator triggers one manually for an unplanned event such as a major migration.
Storage and listing
The snapshot sits in the repository. It can be listed, inspected for its size and included indices, and verified without being restored.
Restore
When needed, a restore operation reads the manifest and segment files back into a live cluster, either the original one or a different one.
Expiry
The daily retention job evaluates every snapshot’s age and position against the policy’s rules and deletes the ones that no longer qualify to be kept.
flowchart LR A["Create snapshot
scheduled or manual"] --> B["Store in repository"] B --> C{"Restore needed?"} C -->|"Yes"| D["Restore into a cluster"] C -->|"No"| E["Wait"] E --> F["Daily retention check"] F --> G{"Meets retention rule?"} G -->|"No"| H["Delete snapshot"] G -->|"Yes"| E
Restoring is its own operation, not part of SLM
It surprises many newcomers that SLM has nothing to do with restoring data. SLM only creates and expires snapshots. Restoring uses the ordinary restore-snapshot API, which can restore an entire snapshot or only specific indices, and can rename indices during the restore so the original data is not overwritten.
A typical safe pattern is to restore into freshly named indices — for example, restoring orders as orders-restored-2026-09-21 — verify the restored data looks correct, and only then swap it into place, rather than restoring directly over a live index and hoping for the best.
Data streams flow through the same pipeline
A data stream is Elasticsearch’s structure for time-ordered data, such as logs or metrics, made of multiple underlying indices behind one name. SLM can back up data streams directly; each underlying index is snapshotted like any other index, and a restore recreates the stream structure so time-based queries keep working afterward.
A restore only succeeds if the target cluster has enough disk space and enough available nodes to host the restored shards. Restoring a multi-terabyte snapshot into an undersized cluster fails partway through, so restore capacity should be planned before it is urgently needed.
7Designing Retention Rules That Actually Work
Retention is where good backup plans quietly go wrong. The three retention settings interact, and understanding that interaction prevents two very different failure modes: keeping too little, or keeping — and paying for — far too much.
The three retention settings
Maximum age
Snapshots older than this duration become eligible for deletion, for example 30d for thirty days.
Minimum to keep
Never delete a snapshot if doing so would drop the total below this number, even if it is already past its expiry age.
Maximum to keep
Never keep more than this many snapshots, deleting the oldest first, even if they have not expired yet by age.
How the three rules combine
The retention job evaluates every snapshot in a policy together, oldest first, and a snapshot is deleted only when doing so does not violate min_count, and either it is older than expire_after or the total count still exceeds max_count. min_count always wins: even a five-year-old snapshot survives if deleting it would drop the cluster below the configured floor.
Picture a small pantry shelf. The house rule is throw away anything older than two weeks, but always keep at least three jars of sauce no matter what, and never keep more than ten jars total even if they are all fresh. Three separate rules, one shelf, and the strictest applicable rule wins at any moment.
Worked example
A policy takes hourly snapshots, with expire_after: 7d, min_count: 24, max_count: 200. After one week, roughly 168 snapshots exist. All of them are within seven days old, so none expire by age yet, and 168 is comfortably under the 200 maximum, so nothing is deleted. By day nine, the oldest snapshots pass seven days old and begin expiring one by one, but never below 24 remaining, guaranteeing at least a full day of hourly granularity always stays available even under a very aggressive expiry setting.
| Use case | Suggested pattern |
|---|---|
| Fast-changing production index | Frequent snapshots, short expiry, moderate min_count for quick recent rollback |
| Compliance or audit archive | Infrequent snapshots, very long or no expiry, high max_count, separate policy from operational backups |
| Log or metrics data streams | Daily snapshots aligned with index lifecycle management rollover, moderate retention matching data-stream retention |
| Pre-upgrade safety net | One manual, unmanaged snapshot taken just before the upgrade, kept outside any policy’s retention |
Because segments are shared across snapshots, deleting one middle-aged snapshot rarely frees much space if its neighbors still reference the same files. Storage cost is driven mainly by how much source data changes, and by how long the oldest surviving snapshot’s referenced files must be retained — not simply by the count of snapshots shown in a list.
8Multiple Policies and Tiered Backup Strategies
Real clusters rarely run one policy. Different data deserves different frequency, different retention, and sometimes a different repository entirely.
Why one policy is usually not enough
A single cluster commonly holds customer-facing transactional data, internal analytics, and raw application logs side by side. Backing all three up on the same hourly, thirty-day schedule wastes money on the logs and under-protects the transactional data if a shorter interval is really warranted. Splitting into several policies lets each dataset get exactly the protection it needs, no more and no less.
| Policy | Scope | Frequency | Retention |
|---|---|---|---|
| critical-hourly | orders-*, payments-* | Every hour | 7 days, min 24, max 200 |
| app-daily | app-*, catalog-* | Once daily | 30 days, min 7, max 60 |
| logs-daily | logs-* data streams | Once daily | 14 days, min 3, max 20 |
| global-state-weekly | Cluster settings and templates only | Once weekly | 90 days, min 4, max 12 |
Separate repositories for separate risk
Some organizations register a second repository in a different cloud region, or even a different cloud provider, and run a lower-frequency policy against it purely as a disaster-recovery copy. If the primary repository’s account or region becomes unreachable, this second copy is what stands between the organization and a total loss.
flowchart TB
Cluster["Production Cluster"] --> R1[("Primary Repository
Region A")]
Cluster -->|"lower frequency"| R2[("DR Repository
Region B, different account")]
R1 -.->|"read-only mount"| DRCluster["Standby Cluster, Region B"]
R2 -.->|"read-only mount"| DRCluster
Give each policy its own name pattern and its own metadata stamp. Overlapping name patterns between two policies can make it hard to tell, months later, which policy actually produced a given snapshot when investigating an incident.
9Performance and Scalability
Snapshots are cheap thanks to incremental copying, but they are not free. Understanding what actually consumes resources keeps SLM from becoming an unwelcome surprise on a busy cluster.
Where the cost really goes
Upload bandwidth
New segment bytes must travel from each data node to the repository, competing with normal indexing and search traffic on the same network interfaces.
Read pressure
Reading segment files to upload them adds disk read load, which matters most on nodes already near their I/O limits.
Compression
Some repository types compress data before upload, briefly using CPU cycles that are otherwise available for query processing.
Bookkeeping
Every snapshot and every policy run adds entries to cluster state and history, which very large numbers of policies or snapshots can bloat over time.
Snapshots scale with change, not with total size
Because of the segment-sharing behavior covered earlier, a snapshot’s cost during a normal run is proportional to how much data changed since the previous snapshot, not to the full size of the index. A 10 TB index that changes by 50 GB a day produces roughly 50 GB snapshots most days, which is why SLM remains practical even on very large clusters.
The first snapshot of a brand-new large index is the expensive exception, since there is nothing yet to reuse — every segment must be uploaded. Teams bringing a large existing cluster under SLM for the first time should expect that first run to take noticeably longer and to schedule it at a quiet time.
Concurrency limits protect the cluster
Elasticsearch limits how many snapshot operations can run at once, through settings controlling maximum concurrent snapshots per repository and per cluster. These limits exist because unlimited concurrent snapshot activity could saturate disks and network links that indexing and search also depend on.
Staggering multiple policies’ schedules, rather than firing them all at the same top-of-hour moment, smooths out the network and disk impact instead of creating a recurring spike every hour on the hour.
What an interviewer may ask
10High Availability and Reliability
SLM is built to keep working through node failures and master elections, but a few realities are worth knowing before relying on it in a crisis.
Master failover mid-snapshot
If the elected master node fails while a snapshot is in progress, a new master is elected using the cluster’s normal election process, and it takes over SLM duties immediately because policy definitions and schedules live in replicated cluster state, not on any single node’s local disk. A snapshot that was actively uploading at the exact moment of failover, however, may be left in an incomplete state and typically needs to be retried on the next scheduled run or manually.
Repository outages
If the repository itself becomes unreachable — a cloud storage outage, expired credentials, a network partition — snapshot attempts fail, and SLM records the failure in the policy’s status rather than crashing anything else in the cluster. Indexing and search continue completely unaffected, since snapshotting is a background activity layered on top of normal cluster operation, not a blocking one.
flowchart TD
A["Snapshot in progress"] --> B{"Master fails?"}
B -->|"Yes"| C["New master elected"]
C --> D["SLM resumes from cluster state"]
D --> E["In-flight snapshot marked incomplete"]
E --> F["Retried on next scheduled run"]
B -->|"No"| G["Snapshot completes normally"]
Reliability comes from testing, not just scheduling
The single most common real-world SLM failure is not a missing snapshot — it is a snapshot that exists but was never test-restored, and turns out to be unusable when finally needed, whether from a silently misconfigured repository, missing indices, or a restore procedure nobody had actually rehearsed under pressure.
Mature teams schedule periodic restore drills: restore a recent snapshot into an isolated test cluster, verify document counts and a sample of records, and time how long the process takes. This is the only reliable way to know that RTO assumptions from earlier chapters actually hold true.
11Security Considerations
A backup system that anyone can read or delete is not really a safety net — it is a second attack surface. SLM’s security model layers on top of Elasticsearch’s regular access control.
Permissions that matter
manage_slm
Allows creating, editing, and deleting SLM policies, and manually triggering a policy’s snapshot.
read_slm
Allows viewing policies and their run history without being able to change or trigger anything.
manage repository access
Separately controls who can register, modify, or remove the underlying repository definitions themselves.
Splitting these permissions matters in practice. A monitoring dashboard service account typically needs only read_slm. A platform team automating policy rollout needs manage_slm. Very few people, ideally, should hold the ability to delete or reconfigure the repository itself, since that is the one action capable of destroying every existing backup at once.
Protecting the repository from the cluster it protects against
If an attacker gains full administrative access to the Elasticsearch cluster and the cloud credentials it uses reach the repository, they can potentially delete both the live data and its backups. Cloud object storage features such as versioning, write-once-read-many (WORM) locks, or a separate account boundary for the backup bucket meaningfully reduce this risk by ensuring the cluster’s own credentials cannot casually erase snapshot history.
Encryption
Data in transit to cloud repositories is encrypted using the storage provider’s standard TLS connections. Data at rest depends on the repository: cloud object stores typically offer server-side encryption by default, and Elasticsearch can also work with repositories layered under disk-level or provider-managed encryption for stricter compliance needs.
What an interviewer may ask
12Monitoring, Logging, and Metrics
A policy nobody watches is a policy that can silently fail for weeks. SLM exposes enough status information to build real alerting around it.
What to watch
Last success time
Every policy tracks when it last completed successfully; alert if this falls further behind than the schedule allows.
Last failure and reason
The most recent failure and its error message are stored, useful both for alerting and for diagnosing recurring issues.
Success and failure counts
Running totals reveal whether a policy is flaky over time rather than failing once by chance.
SLM history index
When enabled, every run — creation and deletion alike — is logged as a searchable document, ideal for dashboards and long-term auditing.
A simple, effective alert
The most valuable single alert most teams can add is straightforward: compare “time since last successful snapshot” against the policy’s expected interval, and page someone once that gap exceeds roughly two to three times the scheduled frequency. An hourly policy silent for six hours deserves attention long before it becomes a genuine emergency.
flowchart LR
A["SLM Policy Status API"] --> B["Monitoring system polls status"]
B --> C{"Last success older than threshold?"}
C -->|"Yes"| D["Alert on-call engineer"]
C -->|"No"| E["No action"]
A --> F["SLM History Index"]
F --> G["Dashboard: success rate, duration trend"]
A repository can silently degrade — filling up, losing credentials, or hitting a cloud provider quota — well before SLM itself reports failures. Monitoring the repository’s own verification status and available storage catches problems earlier than watching SLM alone.
13Deployment and Cloud Context
SLM behaves slightly differently depending on whether Elasticsearch runs self-managed, on Elastic Cloud, or inside a Kubernetes deployment.
Full manual control
Operators register their own repository and write every policy by hand, with complete freedom but full responsibility for getting it right.
Managed defaults
A managed repository and a default SLM policy are typically preconfigured, though teams can still add their own policies for additional indices or retention needs.
Declarative configuration
Elastic Cloud on Kubernetes allows repository and policy configuration through Kubernetes custom resources, keeping backup configuration in version control alongside the rest of the cluster’s definition.
Cross-cloud and hybrid repositories
A cluster running in one cloud provider can still snapshot into another provider’s object storage, since repository plugins connect over the network rather than requiring the storage to be local. This is a common way to build the cross-region or cross-provider disaster-recovery pattern introduced in Chapter 8, keeping backup infrastructure independent from a single provider’s outage blast radius.
Because SLM policies are simple JSON definitions, most teams manage them the same way they manage index templates: committed to a repository and applied through a deployment pipeline, so a policy change goes through code review just like any other production configuration change.
14Design Patterns and Anti-Patterns
Years of production use have surfaced a handful of patterns that work well, and an equally memorable set of mistakes that keep recurring.
Patterns worth copying
Tiered frequency by data value
Match snapshot frequency and retention to how expensive it would be to lose or rebuild that specific data, rather than applying one setting cluster-wide, as shown in Chapter 8.
Separate global-state policy
Keep a dedicated, lower-frequency policy purely for cluster settings and templates, independent from high-frequency data policies, so configuration history does not get pruned by an unrelated data-retention schedule.
Pre-change manual snapshot
Before a major version upgrade, reindex, or mapping change, take one manual snapshot outside any policy’s retention rules, kept until the change is confirmed successful.
Cross-account repository
Store the repository under cloud credentials separate from the cluster’s own operating credentials, limiting the blast radius of a compromised cluster.
Anti-patterns to avoid
The problem
Relying on replicas alone and assuming they provide adequate backup protection.
Why it fails
As shown in Chapter 2, replicas mirror every change instantly, including harmful ones, and offer zero protection against deletion, corruption, or malicious action.
The problem
Never test-restoring a snapshot after the policy is set up.
Why it fails
A snapshot that has never been restored is unverified. Misconfigurations, missing permissions, or an unusable repository state can all sit hidden until the worst possible moment.
The problem
Setting retention so aggressively low that a slow-to-detect data problem outlives every remaining snapshot.
Why it fails
If a subtle data corruption bug takes three weeks to notice, but only two weeks of snapshots are kept, every remaining backup already contains the corruption.
15Best Practices and Common Mistakes
A concise, practical checklist distilled from the chapters above, organized as pros to lean into and cons to actively guard against.
Do
- Register and verify the repository before writing any policy
- Give every policy a clear, purpose-based name
- Set all three retention fields deliberately, not just expire_after
- Run periodic restore drills into an isolated cluster
- Alert on time-since-last-success, not just on explicit failures
- Separate repository-deletion permissions from everyday snapshot permissions
Avoid
- Assuming replicas remove the need for snapshots
- Scheduling every policy at the exact same top-of-hour moment
- Letting one repository be written to by more than one cluster
- Setting retention so short that slow-to-detect problems outlive all backups
- Granting broad cluster-admin rights just to allow snapshot management
- Forgetting a separate, longer-retention policy for global state and templates
16Trade-offs: Frequency, Cost, and Recovery Speed
Every SLM decision trades one good thing for another. Naming the trade-off explicitly leads to better decisions than treating any single setting as simply “correct.”
| Choice | What you gain | What you give up |
|---|---|---|
| More frequent snapshots | Lower RPO, less potential data loss | More network and disk load, more snapshots to manage |
| Longer retention | More recovery points to choose from, better audit trail | Higher storage cost, slower repository listing operations |
| Including global state every run | Simpler single-policy setup | Configuration snapshots tied to data retention instead of their own schedule |
| Cross-region DR repository | Protection from a full regional outage | Extra cost and extra complexity to maintain and test |
| Source-only repository | Smaller repository storage footprint | Slower restores, since indices must be rebuilt rather than copied directly |
There is no universally correct answer to any row in this table — only the answer that fits a given system’s actual RPO and RTO targets, its budget, and how quickly problems in that particular dataset tend to be noticed.
17Real-World and Industry Usage Patterns
SLM’s design choices make far more sense once seen against how organizations actually run Elasticsearch at meaningful scale.
Logging and observability platforms
Companies running centralized logging on Elasticsearch, a pattern widely used across the industry for application and infrastructure logs, typically pair SLM with index lifecycle management: newer log indices stay on fast storage, older ones roll to cheaper storage tiers, and SLM snapshots them along the way so even long-tail historical logs remain recoverable without keeping every index hot indefinitely.
E-commerce search
Retail platforms depend on Elasticsearch to power product search and recommendations. Because a broken index directly blocks sales, these deployments commonly favor frequent, tightly monitored snapshots of catalog and inventory indices, often the “critical-hourly” style pattern introduced in Chapter 8.
Security and SIEM platforms
Security information and event management systems built on Elasticsearch often carry compliance obligations requiring data to be retained and provably unaltered for months or years, making the long-retention, WORM-protected repository pattern from Chapter 11 especially relevant.
Regulated finance and healthcare
Organizations in these industries frequently mandate periodic, auditable restore testing as a compliance requirement rather than an optional best practice, turning the restore-drill guidance from Chapter 10 into a documented, recurring control rather than a nice-to-have.
Across every one of these patterns, the organizations that treat snapshots casually are the ones caught out during an incident, while the ones that monitor SLM status and rehearse restores treat a bad day as an inconvenience rather than a crisis.
18Advanced Topics: Searchable Snapshots and Cold Tiers
Recent Elasticsearch versions extend what a snapshot can do beyond pure backup, blurring the line between “backed up” and “still queryable.”
Searchable snapshots
A searchable snapshot lets a snapshot in a repository be mounted directly as a queryable index, without fully restoring every byte back onto local disk first. Data is read from the repository on demand, with local caching for frequently accessed portions. This effectively turns the repository itself into a very cheap, very cold storage tier that can still answer occasional queries, most commonly used for older log or metrics data that is unlikely to be searched often but must remain available.
A normal restore is like moving every box out of a storage unit back into your house before you can use any of it. A searchable snapshot is like being able to walk into the storage unit and grab exactly the one item needed, right where it sits, without moving the whole unit home first.
How this connects back to SLM
SLM itself does not change when searchable snapshots are used — it still creates ordinary snapshots on schedule. What changes is what happens to a snapshot afterward: instead of only sitting in the repository as a pure backup, older data’s snapshot can also be mounted as a cold-tier searchable index, letting one snapshot serve two purposes at once, backup and cheap long-term query access.
flowchart LR SLM["SLM creates
scheduled snapshot"] --> Repo[("Repository")] Repo -->|"full restore"| Hot["Restored index
fully on local disk"] Repo -->|"mount as searchable snapshot"| Cold["Cold-tier queryable index
data stays in repository"]
A searchable snapshot index still depends entirely on the snapshot continuing to exist in the repository. If SLM retention deletes the underlying snapshot, any searchable snapshot index built from it stops working, so retention rules for data serving a cold tier must be planned with that dependency in mind.
19Complex Failure Scenarios and Recovery
Working through a few concrete failure stories ties every earlier chapter together into practiced judgment rather than isolated facts.
Scenario one: the wildcard delete
An engineer meant to delete a single test index but a shell wildcard expanded to match twelve production indices as well. Replicas offered no protection, since the delete propagated everywhere instantly. The response: identify the most recent snapshot from before the delete using the policy history from Chapter 12, restore the affected indices under temporary names as described in Chapter 6, verify document counts against known application metrics, then rename them back into production use.
Scenario two: the silent repository failure
A cloud credential rotation broke the repository’s write access, but nobody had wired up the alerting from Chapter 12. Three weeks passed with every SLM run failing quietly. The gap was only discovered during an unrelated audit. The fix going forward: the time-since-last-success alert became a required part of every new cluster’s setup checklist, not an optional extra.
Scenario three: retention too aggressive for the problem
A subtle ingestion bug corrupted a small percentage of documents over several weeks before being noticed. Because retention had been set to keep only ten days for cost reasons, every remaining snapshot already contained corrupted data. The only path forward was rebuilding from the original source system, since Elasticsearch itself had no clean copy left. This is precisely the anti-pattern flagged in Chapter 14, and afterward the team extended retention specifically for indices fed by that ingestion path.
flowchart TD
A["Incident detected"] --> B["Check SLM policy status and history"]
B --> C["Identify last known-good snapshot"]
C --> D["Restore into temporary index name"]
D --> E["Verify data with counts and spot checks"]
E --> F{"Data looks correct?"}
F -->|"Yes"| G["Swap into production use"]
F -->|"No"| H["Try an earlier snapshot, or rebuild from source"]
20Frequently Asked Questions
22SLM Compared to Other Backup Approaches
SLM did not appear in a vacuum. Comparing it against the approaches teams used before, and against approaches from outside Elasticsearch entirely, makes clear exactly what problem it solves and where its boundaries sit.
SLM versus Curator
Before SLM existed, a popular open-source tool called Curator handled index maintenance tasks, including triggering snapshots and deleting old ones based on age or count. Curator ran as an external process, usually on a cron schedule of its own, completely outside the Elasticsearch cluster it managed. This meant Curator’s schedule, its credentials, and its own uptime were all a separate thing that had to be deployed, patched, and monitored, on top of the cluster itself.
SLM absorbed Curator’s snapshot-management responsibilities directly into Elasticsearch. There is no external process to deploy, no separate credential set to secure, and no separate monitoring system needed just to know whether the backup tool itself is still running. The trade-off is flexibility: Curator could be scripted to do highly custom, cross-tool orchestration, while SLM intentionally stays focused and declarative, covering the common cases well rather than trying to cover everything.
SLM versus filesystem or volume-level backups
Some teams instead back up the raw data directories on disk, or take storage-volume snapshots at the infrastructure layer, such as cloud block-storage snapshots. This approach can look appealing because it needs no Elasticsearch-specific tooling at all. It carries a serious risk, though: Elasticsearch writes across many files as documents are indexed, and a volume snapshot taken mid-write, without the cluster’s cooperation, can capture an inconsistent, unusable state unless the node is fully stopped or specifically flushed and locked first, which is disruptive in a live production system.
SLM avoids this problem entirely because it works through Elasticsearch’s own snapshot API, which coordinates with the cluster to capture a consistent view of each shard while it continues serving live traffic, as explained back in Chapter 3.
SLM versus third-party backup products
Commercial backup products sometimes wrap Elasticsearch’s own snapshot API with a friendlier interface, extra scheduling features, or cross-product orchestration across several different databases at once. Under the hood, most of them still call the same underlying repository and snapshot mechanisms this guide has described. For a team running only Elasticsearch, SLM alone is usually sufficient and avoids an extra product to license and maintain; for a team standardizing backup tooling across many different database technologies, a third-party product’s unified interface can be worth the added cost and complexity.
| Approach | Runs where | Consistency guarantee | Extra tooling needed |
|---|---|---|---|
| SLM | Inside the cluster | Per-shard consistent, coordinated automatically | None |
| Curator | External process | Same as SLM, since it calls the same API | A separate scheduler and deployment |
| Volume snapshots | Infrastructure layer | Risky unless the node is stopped or flushed first | Storage-layer snapshot tooling |
| Third-party product | External service or agent | Same as SLM under the hood, for Elasticsearch specifically | A licensed product and its own agents |
23An Operational Runbook: Rolling Out SLM Step by Step
Bringing everything together, here is the order a team typically follows when adopting SLM on a cluster for the first time, from a blank slate to a monitored, tested backup routine.
Choose and provision storage
Decide on a repository type based on where the cluster runs, provision the bucket or shared location, and set up credentials scoped only to what the snapshot process needs, following the separation-of-privilege guidance from Chapter 11.
Register and verify the repository
Register the repository in the cluster and confirm every node can reach and write to it, before any policy is created, as covered in Chapter 3.
Classify the data
Group indices and data streams by how costly their loss would be and how quickly problems in them tend to be noticed, forming the basis for the tiered policy design from Chapter 8.
Write the policies
Create one policy per tier, each with its own schedule, name pattern, and retention settings, staggering their fire times to avoid overlapping load as noted in Chapter 9.
Run an initial manual snapshot
Trigger the first snapshot for each policy manually rather than waiting for the schedule, since the first run is the expensive, non-incremental one described in Chapter 9, and it is better to observe that cost during a planned window.
Wire up monitoring and alerting
Add the time-since-last-success alert and a dashboard built from the SLM history index, following the pattern in Chapter 12, before considering the rollout finished.
Run a restore drill
Restore a completed snapshot into an isolated test cluster and verify the data, closing the loop described in Chapter 10 so the backup is proven, not just assumed to work.
Document and hand off
Record which policy covers which data, its RPO and RTO targets, and the restore procedure, so the on-call engineer during a real incident is not learning SLM for the first time under pressure.
Data grows, indices get added and removed, and what counted as “critical” a year ago may have changed. Treat this runbook as a periodic review, not a one-time setup task, and repeat the restore drill on a recurring calendar rather than only once at launch.
21Summary and Key Takeaways
The essentials, in one place
- SLM automates three jobs: creating snapshots on a schedule, expiring old ones by rule, and recording what happened, removing the fragile custom scripts teams relied on before it existed.
- Replicas and snapshots solve different problems. Replicas protect against a node dying; snapshots protect against mistakes, corruption, and malicious deletion, and a production cluster needs both working together.
- Incremental copying makes snapshots cheap. Because Lucene segments never change once written, each new snapshot after the first only needs to upload what actually changed.
- A policy has five parts: schedule, snapshot name pattern, repository, index and global-state configuration, and retention — and every policy anyone writes maps cleanly onto those five ingredients.
- Retention needs all three settings working together — expire_after, min_count, and max_count — with min_count always taking priority over pure age-based expiry.
- Restoring is a separate operation from SLM. SLM only creates and expires snapshots; restoring, including safe restore-under-a-new-name patterns, uses its own dedicated API.
- An untested backup is not a proven backup. Regular restore drills into an isolated cluster are what actually turn a configured policy into a trustworthy recovery plan, and monitoring time-since-last-success closes the gap that silent failures otherwise exploit.