OpenSearch index lifecycle and data retention

Index State Management policies, rollover aliases and snapshots let you keep retention rules and storage costs predictable. This page covers the decisions, build sequence, effort and checks.

On this page

How OpenSearch index lifecycle keeps retention rules and storage costs in check

Log, observability and security data grows every day, and the rules for how long it must be kept come from policy, legal or audit teams, not from the search engineers who store it. Index lifecycle management automates the moves that enforce those rules: rolling over a write index when it reaches a size or age, shrinking it, moving it to cheaper nodes and finally deleting it. In OpenSearch, Index State Management (ISM) runs these steps as policies attached to indices. Doing this by hand works for a few indices and fails as the number of indices, sources and teams grows.

The task is harder than the policy file suggests. Retention is a business and compliance decision, so the number of days, the stages and the exceptions for particular sources need written sign-off before anyone configures them. The policy also has to match how indices are named, which index templates apply to them and which aliases your applications write and read through. A policy attached to the wrong pattern, or an index created outside the template, will quietly skip its rules. Deletion is irreversible unless a recent snapshot exists, so the snapshot schedule and its own retention must be designed alongside the delete step, not after it.

Node roles and shard allocation awareness decide where data can move. A tier move only works if the target nodes carry the attributes the policy expects, and allocation rules can block a move that looks correct on paper. Before you rely on any step, confirm how ISM behaves on your exact OpenSearch version, including its defaults, supported actions and limits, in the official documentation for that release, and test the full lifecycle on a non-production cluster with sample indices that match your real naming and aliases.

Which OpenSearch components make up a lifecycle setup

A lifecycle setup is several components working together: policies that move and delete indices, templates that give new indices the right settings, aliases that keep writers stable, node placement that matches data to storage, snapshots for long-term copies, and access controls over who may change any of it. A gap in one part usually shows up as missed retention or unexpected storage growth in another.

Index State Management policies

An ISM policy defines the states an index passes through, such as hot, warm, cold and delete, and the actions and age or size conditions that trigger each move. This is the schedule that rolls, shrinks, moves and deletes indices. Misconfigured conditions are the most common failure: a delete action with the wrong minimum age removes data early, and a missing transition leaves old indices on expensive storage. Check each policy against the written retention requirement and test it on a non-production index before attaching it to live data.

Cluster docs

Index templates

An index template applies settings, mappings and the attached ISM policy to every new index whose name matches a pattern. Templates make lifecycle behavior automatic, so a new daily index gets the same policy as the last one without manual work. If the pattern overlaps another template or the priority is wrong, indices may land with no policy or the wrong one, and nothing fails loudly. Confirm which template matches each index pattern before go-live.

Rollover aliases

A rollover alias points writers at a stable name while the underlying index is replaced when it reaches a size, age or document threshold. Rollover keeps index sizes within the range the sizing plan expects and gives ISM clean units to act on. The usual mistake is a write alias without an initial index that carries the rollover settings, or applications writing to a concrete index name that never rolls. Confirm that every writer uses the alias and that the rollover conditions match the retention plan.

Node roles and shard allocation awareness

Cluster manager, data, ingest and coordinating nodes are the roles the cluster docs define, and data nodes hold the shards that ISM actions move. Shard allocation awareness uses node attributes, such as a tier or zone label, to decide where shards may sit, which is how indices are moved toward cheaper hardware. If the attributes are missing or set inconsistently, a move action can stall with shards that never relocate, or shards can crowd onto the same nodes. Confirm the attribute names and node labels in the cluster configuration before writing move actions.

Snapshot repositories for long-term copies

Snapshot repositories hold copies of indices outside the live cluster, which is how data is kept beyond what the hot and warm tiers can hold cheaply. A snapshot policy must run on a schedule and be kept separate from the delete step, because deleting a live index does not remove its snapshots. The main risk is a repository that fills up or fails silently, leaving the team believing older data is retained when no recent copy exists. Verify that snapshots complete, that restores are tested, and that the storage location is covered by the same access controls as the data.

Security plugin roles for policy changes

Security plugin roles decide who can create, change or delete ISM policies, templates and aliases, and who can read the audit trail of those changes. Without this control, a user with broad cluster permissions can shorten retention or delete an index on purpose or by mistake. Define a role that allows lifecycle administration separately from data read and write, and enable audit logging so policy edits are traceable. Confirm the mapping from identity provider groups to these roles during the access design, not after the first incident.

Security docs

Which retention model fits your data and how it changes operations

This table compares the main retention choices for OpenSearch indices and the operational work each one creates. Read each row as a trade-off: the option you pick sets how many policies, allocation rules and restore steps your team will own. The main takeaway is that simpler policies are cheaper to test and review, so add complexity only where a retention or access requirement demands it.

OptionWhen it fitsWhat it costs you operationally
Time-based rolloverData arrives at a fairly steady rate and retention is defined in days, such as application or audit logs with a fixed keep periodPredictable index names and expiry dates, but a quiet or bursty source can leave indices much smaller or larger than planned, so review rollover conditions after traffic changes
Size-based rolloverIngest volume varies a lot and you need each shard to stay within a size your nodes handle wellIndex age is less predictable, so retention reports must read index creation dates rather than assume a fixed window; confirm shard size targets with your sizing plan
Single-tier placementSmall clusters, short retention or data that is queried evenly for its whole lifeLeast configuration to test, but all data sits on the same hardware, so storage cost rises with every day of retention
Hot-warm-cold placementRecent data is searched heavily and older data is rarely queried but must stay availableNeeds node attributes, allocation rules and migration policies that you test on every upgrade, and the tiers need their own capacity monitoring
Delete after expiryRetention requirement ends at a set age and no copy of the data is needed afterwardFast and simple to audit, but deleted data cannot be restored without a separate snapshot, so confirm that the retention rule allows deletion at that point
Snapshot, then deleteRecords must remain recoverable for longer than they stay searchableAdds snapshot repository access, retention of snapshots, and periodic restore tests; each of these needs an owner and evidence for assessors
One policy per index patternSeveral sources share the same retention period and naming conventionFew policies to review, but a change for one application can affect every index that matches the pattern, so confirm pattern overlap before editing
One policy per data stream or applicationSources have different legal, business or privacy retention periodsMore policies and allocation rules to review and test, but each change has a narrower blast radius and a clearer audit trail

How to build the lifecycle policy from retention requirement to first deletion

This sequence turns retention and legal hold requirements into a tested OpenSearch Index State Management policy that rolls over, moves and deletes indices on schedule. It ends with a verified snapshot restore, so the team knows deletion is safe before it runs against production data.

  1. Collect retention and legal hold requirements per data class

    Work with the data owners, compliance lead and legal team to list each index family (for example application logs, audit events, security alerts) with its required retention period, any legal hold rules, the data's sensitivity and who may approve early deletion. Record the answers in a retention register that names the owner of each class. The step is done when every index pattern in scope maps to one written retention rule and one named approver, and the team can state which classes must never be deleted automatically.

  2. Define index naming and component templates

    Set a naming convention that encodes the data class and a rollover-friendly sequence, such as a prefix per class followed by a six-digit counter, and write one index template per class. Keep settings like shard count, replicas and mappings in component templates so the lifecycle settings can be changed without rebuilding every index. The check is that a test index created from each template matches the naming pattern and inherits the expected mappings and settings in the cluster state.

  3. Create the rollover alias and write index

    For each data class, create the first index with the write alias set to true, so that the alias points to exactly one write index. Applications write to the alias, never to a concrete index name. Confirm the rollover conditions you will use (such as maximum index age, document count or primary shard size) against your ingestion volume and the sizing guidance for your cluster, because these thresholds decide how many indices exist at any time. The check is that the alias resolves to one write index and that a test rollover produces a new write index while the old one stays readable.

  4. Define ISM policy states and transitions

    In Index State Management, write a policy with states that match your retention register: a hot state for active writes, a warm state for read-only indices that are force merged or shrunk, optional cold or snapshot states where the requirement allows, and a delete state at the end of retention. Each transition needs a condition based on index age or size, and each state should set only the actions its data class needs. Document the policy in a change record and confirm with your security and compliance leads that the final delete step cannot run before the legal hold window closes. The check is that the policy validates with no errors and that a simulated index moves through each state in the expected order.

  5. Attach the policy through the index template

    Reference the ISM policy in the index template for each data class so that every new index, including each rollover index, receives it automatically. Avoid attaching policies by hand to existing indices unless a migration plan covers them. Confirm the template setting that names the policy and check the policy assignment on indices created after the change. The check is that new indices in each class report the expected policy and state, and that no index in an unrelated pattern picked up the policy by mistake.

  6. Configure the snapshot repository and registration

    Register a snapshot repository in the storage location your retention rules allow, with access controls limited to the cluster's snapshot role and encryption settings confirmed by your security team. Add a snapshot step to the ISM policy where you need an offline copy before deletion, and set a snapshot policy for recovery. Confirm the repository location, access method and retention of snapshots with the storage owner, because snapshot copies also fall under your retention and deletion rules. The check is that the repository verifies from every data node and a test snapshot completes and lists in the repository.

  7. Test the lifecycle against a non-production index set

    Copy a representative, non-production set of indices with realistic structure but masked or synthetic data, then run the full lifecycle with compressed age conditions in a test cluster. Include a rollover, a warm transition, a snapshot, a deletion and a restore of one snapshot into a scratch index. Read back documents from the restored index and compare counts and sample fields with the source. Record any ISM failures from the explain API and fix them before production. The check is that the restored snapshot reads back with the same document count and sample values, and that the legal hold case blocks deletion as the register requires.

  8. Promote the policy to production with a review

    Apply the tested templates, policies and repository settings to production in a change window, then monitor the ISM explain output and the first rollover and transition for each data class. Assign an owner to review policy failures and an owner to approve any change to retention periods. Keep the test evidence, the retention register and the policy versions together so auditors and internal reviewers can trace each deletion back to a documented rule. The check is that the first production rollover and transition complete with no failed ISM steps, and that the evidence bundle is stored with the retention register.

How an index moves from hot writes to snapshot and deletion

The diagram follows one index from the write alias, through rollover into a new hot index, then to warm nodes through allocation rules, with an optional shrink step before a snapshot to a repository. Indices under legal hold branch away from deletion and stay in place. Check the trigger for each transition, because a rollover, a move or a delete that fires on the wrong condition is the most common source of lost or retained data that should not be.

Index lifecycle path from write alias to deletion, with a legal hold branch.

How lifecycle setups differ across single node, HA, Kubernetes and air-gapped deployments

A single-node cluster is common for development, testing and small proofs of concept. With one node there is no replica placement across machines, no separate data tier and no independent place to keep snapshots that survives the node itself. Index State Management still works here, so teams can practice writing policies, but tiering and snapshot schedules deliver limited value because a disk failure takes the data and the snapshots with it unless snapshots are copied off the host.

  • Keep policies simple: a rollover and delete policy is usually enough to exercise the API and validate index patterns.
  • Do not treat it as a retention control: data on the only node is not protected against host loss, so retention promises should not be made from this environment.
  • Avoid warm and cold tiers: without multiple nodes with different storage, moving indices between tiers adds configuration with no benefit.
  • Use a separate snapshot location if data matters: if development data holds anything regulated, copy snapshots to storage outside the host.
  • Plan the promotion path: record which policy names and index patterns will carry into production so they are not rebuilt later.

Confirm with your own environment team whether the development cluster holds production-like data, because that answer decides whether this tab's shortcuts are acceptable.

What drives the effort and cost of lifecycle work and how to contain it

This table lists the factors that change the design, build, testing and handover effort for OpenSearch lifecycle policies, with how each one moves the work and how to keep it contained. Read each row as a question to answer in the scoping conversation before a quote is written. The main takeaway is that the number of distinct retention rules and downstream readers of deleted data usually matter more than raw data volume.

DriverHow it moves effortHow to keep it down
Number of data streams and index patternsEach pattern needs its own rollover, shrink and delete path, template binding and test. Effort grows with pattern count more than with index count.Group sources by retention class and name indices so one policy covers many patterns. Confirm the naming scheme before policies are written.
Number of distinct retention rulesEvery separate retention period adds a policy, a validation case and an approval. Rules that differ by a few days often cost as much as rules that differ widely.Negotiate a short list of standard retention classes with the data owners and the compliance lead before build starts.
Data volume and growth rateHigher daily volume shortens rollover intervals, increases snapshot size and raises the cost of any reindex or shrink step. Growth changes the sizing assumptions the policies depend on.Ask for current daily ingest and expected growth in writing, then set rollover thresholds by size and age together. Review thresholds after the first quarter of real data.
Tiering requirements and node countMoving indices between hot, warm or cold nodes needs node attributes, allocation rules and capacity on each tier. Each extra tier adds configuration, monitoring and failure cases to test.Tier only where access patterns or cost justify it. Confirm which node roles and attributes the cluster already uses before adding a tier.
Integrations that read deleted or moved dataDashboards, alerts, saved searches, scheduled reports and external consumers can break when an index is shrunk, moved or deleted. Finding each reader takes investigation and is often the largest discovery task.Build an inventory of readers and their index patterns during design. Use aliases so consumers reference a stable name rather than a backing index.
Compliance evidence and legal holdsAuditors may ask to see the retention rule, proof it ran, and how a hold suspends deletion. Hold handling needs its own process, roles and test cases.Agree the evidence list up front (policy export, execution history, snapshot records). Confirm with your compliance team which holds apply and who can place them.
Snapshot repository and backup dependenciesDeletion policies and snapshot retention interact. Removing an index does not remove it from existing snapshots, so the snapshot schedule must match the retention promise.Document both schedules together and test a restore from a snapshot taken before a deletion. Confirm the repository location and access controls in your environment.
Number of environments and change controlEach environment needs the same policies, tested separately, with promotion and rollback steps. Production approvals can add review cycles that the build itself does not show.Manage policies as versioned configuration and promote them through the same pipeline as other code. Confirm which teams approve changes before work is scheduled.

How to prove the policies run, delete the right data and fail safely

The retention claim is only as good as the evidence behind it, so treat each lifecycle rule as something to test before it touches production data. Start with controlled test cases on a non-production cluster that mirrors your index naming, templates and node layout. Confirm that a newly created index from each template actually receives the intended policy, using the explain interface for indices in your version (confirm the exact endpoint and output fields in the Index State Management documentation for your release). Then force a rollover with a small, deliberate threshold and check that it fires on the stated condition, not on a neighboring one. Next, verify tier moves: after an index transitions, check that its shard allocation filters or node attributes place it where your storage design says it should go, and that hot nodes are not left holding data that was meant to move. Snapshot completion and restore are the other half. Restore a snapshot into a scratch cluster, query document counts and a sample of records, and compare them with the source. Finally, run deletion against a set of indices where only some are past their retention date, and confirm that nothing outside the expired set disappears.

Plan for four failure modes and rehearse each one. A policy stuck in an error state is common after a mapping, template or node change, so alert on managed indices that report an error or stop advancing, and know the retry or remove steps for your version (confirm them in the status and explain output). A failed snapshot blocking deletion matters because a retention rule that deletes an index before its snapshot is verified can destroy the only copy; decide whether your delete step waits on a successful snapshot and make that dependency explicit. An index escaping the template happens when an application writes to a name pattern that no template or policy matches, so the data never ages out; scan for indices without a managed policy on a schedule. A legal hold that is not honored is the most serious. Holds sit outside the normal retention clock, so test that an indexed hold list or tagging method actually stops the delete and rollover actions on the held indices, and confirm with your legal and compliance owners how holds are recorded and released.

Record every test as retention evidence: the date, the cluster version, the policy and template versions, the input conditions, the observed result and the person who reviewed it. Keep these records alongside the snapshot repository configuration and the audit logs for administrative changes, so an assessor can trace a retention rule to a tested outcome. Rerun the suite after every OpenSearch upgrade and every policy change, because behavior can shift between releases. Ask your implementation partner or internal platform team to confirm the explain, status and hold-handling interfaces against the version you run before you rely on any of these checks.

How access control and secrets protect retention settings and deleted data

Retention rules only hold if the people and systems that can change them are limited and watched. The cards below cover the Security plugin roles, separation of duties, audit trails, snapshot repository credentials, encrypted transport and field-level protection that together keep lifecycle policies and deletions under control.

Restrict who can change policies

Index State Management policies decide when indices roll over, move and get deleted, so a wrong edit can remove data early or keep it past its retention window. Use Security plugin roles to limit which users and service accounts can create, change or remove these policies, and give most operators read-only access. Check the role mappings after every SSO or LDAP change, because group membership often grows without review.

Security plugin docs

Separate data owners from platform operators

The team that sets retention periods is usually not the team that runs the cluster. Write down which party approves each retention period, which party applies the policy, and who can override a hold. Map those duties to different roles so one administrator cannot both set and bypass a deletion rule. Ask your compliance lead to confirm the approval path before the first policy goes live.

Audit policy changes and deletes

Without a record of who edited a policy or removed an index, a retention failure cannot be explained to an auditor. The Security plugin provides audit logs, so enable them for policy changes and index deletions and confirm the events reach your central log store. Test the trail by making a harmless policy edit in a non-production cluster and checking that the event is captured with the user identity.

Protect snapshot repository credentials

Snapshots often hold the only copy of data that has already been deleted from live indices, so the repository is a sensitive target. Store repository credentials in the platform's secret handling rather than in configuration files that get copied between hosts, and limit which roles can register or delete repositories. Confirm with your security team how credentials rotate and who can read them.

Encrypt traffic to the repository

Retained data moves between nodes, clients and the snapshot repository, and each hop needs protection in transit. The Security plugin supports TLS for node and client traffic, so enable it across the cluster and verify that the path to your snapshot storage also uses encrypted connections. Check certificate expiry dates in your monitoring, since an expired certificate can stop snapshots from running without an obvious error.

Mask personal data in retained indices

Long retention periods extend the exposure window for personal data, so access to old indices should be narrower than access to recent ones. Where retained documents hold personal data, the Security plugin's document-level security, field-level security and field masking can limit what each role sees. Decide which fields must be masked before data is retained for the full period, and test each role against a sample index.

What to monitor, back up, upgrade and document after go-live

Index State Management policies only work if they run, so monitoring should confirm that each policy is applying its actions on time, not just that the cluster is green. Watch for policies stuck in an error state, indices that stay on an old phase longer than expected, and rollover conditions that never trigger because write traffic has changed. Track disk use per storage tier, since hot and warm nodes fill at different rates, and alert before a tier reaches its watermark. Snapshot success belongs in the same view, because a retention rule that deletes an index without a recent good snapshot is a loss, not a cleanup.

  • Policy error states: Review indices reporting a failed or stuck managed state and the step that failed, then fix the cause before retrying.
  • Rollover lag: Compare the expected rollover timing with the actual index size and age, and investigate indices that grow far past their conditions.
  • Disk use per tier: Track hot, warm and cold storage separately and set alerts well below the cluster's disk watermarks.
  • Snapshot success: Alert on failed or missing snapshots, since deletion steps should wait on a verified backup of the affected data.
  • Alert routing: Send policy and snapshot alerts to the team that owns the retention schedule, not only to general cluster operators.

Confirm your alert thresholds and dashboards against the Index State Management and snapshot documentation for your installed version before relying on them.

Questions buyers ask before hiring help with OpenSearch retention

How much effort does OpenSearch index lifecycle work take, and what drives it?

The effort depends mainly on how many index patterns you have, how many distinct retention rules apply to them, and how many teams must sign off on those rules. A single log stream with one seven-day rule is a small task. Several data classes with different legal holds, tiering needs and rollover sizes take longer to design and test. Other drivers include whether index templates already exist, how much custom work is needed in Index State Management policies, and whether snapshots are already configured for deleted data. Ask any provider for a written scope that lists each index pattern, its retention rule, its owner and the test cases that prove the policy works before anything is deleted.

How long does an OpenSearch lifecycle and retention project take?

The timeline is set by the number of data classes, the time needed to get retention sign-off, and the test window available in a non-production environment. Policy design is usually quick compared with the approval steps: legal, compliance and data owners must agree on what is kept, for how long and where. Testing needs real index volumes and enough time to observe rollover, shrink, move and delete actions across several cycles. Ask for a milestone plan that separates design, approval, staging validation and production rollout, and confirm which of those steps depend on your teams rather than the provider.

What does our team need to provide before lifecycle work starts?

You need to provide the retention requirements, the owner of each data set, and a window for testing. Retention requirements should state the minimum period each data class must be kept, any maximum period for personal or sensitive data, and any legal hold or audit rule that overrides normal deletion. Data owners must confirm which indices they own, which applications write to them, and who may approve a change. A test window in a non-production cluster with representative data is essential. Without these inputs, the work will stop at design and cannot be completed safely.

Can an internal engineer set up OpenSearch Index State Management alone?

An experienced OpenSearch engineer can configure Index State Management policies alone, provided they have access to a non-production cluster, clear retention rules and time to test. The harder parts are usually outside the configuration: agreeing on retention with data owners, confirming that snapshots meet recovery needs, and checking that applications still write and query correctly after indices roll over. Teams without recent OpenSearch operations experience often benefit from a partner review of policy logic, rollover conditions and alias handling. Decide early who will own the policies after handover, because they must change when retention rules change.

How is the risk of accidental deletion controlled?

Deletion risk is controlled by separating retention rules from the delete action, testing every policy against sample indices, and keeping snapshots of data that must be recoverable before a delete step runs. Policies should be reviewed in version control, changed through a documented approval, and applied first to a non-production cluster. Access to change policies or delete indices should be limited to named roles, and audit logging should record who changed what. Confirm with your security team how the Security plugin roles will restrict delete permissions, because lifecycle automation without access control can remove data faster than people notice.

Does index lifecycle configuration change during an OpenSearch upgrade?

Lifecycle policies usually need checking during an upgrade, not a full rebuild. Upgrades can change how Index State Management behaves, how policies are stored and which plugin versions are required, so the policies, templates and aliases should be included in the upgrade test plan. OpenSearch documents four upgrade and migration methods, including rolling upgrades and snapshot and restore, and the right method affects whether existing policies and managed indices move as expected. Before any upgrade, confirm the target version's release notes, test policy execution on a copy of the cluster, and check that rollover aliases still point to the correct write indices.

Does DeployOpen issue audit reports for our retention controls?

No. DeployOpen plans, implements and documents lifecycle controls and prepares the systems and evidence that a compliance assessment will need, such as policy definitions, approval records, test results and configuration exports. Independent auditors and certification bodies issue audit reports, attestations and certifications. Ask your auditor early which evidence they expect for retention and deletion, so the lifecycle design produces that evidence from the start rather than after the fact.

How DeployOpen scopes, builds and hands over OpenSearch retention work

DeployOpen plans, implements, documents and supports self-hosted OpenSearch inside the client's own infrastructure, including the index lifecycle policies that govern retention. Work starts from a written scope that sets which indices, retention periods and storage tiers are covered, and ends with runbooks and evidence that the client's own teams can operate and review.

How we scope

  • Inventory the indices, data streams and aliases that need lifecycle rules, with their owners and write patterns.
  • Record retention requirements per data class, agreed with the client's compliance and legal owners before any policy is written.
  • Agree in writing which storage tiers, hardware or cloud resources, and Index State Management policies are in scope.

How we build

  • Write rollover, shrink, move and delete policies, then test each transition on non-production indices before enabling them.
  • Confirm that replicas, snapshot repositories and node attributes match the tiers the policies assume.
  • Run security and access tests so only the intended roles can change, pause or override lifecycle policies.

How we hand over

  • Deliver policy definitions as version-controlled configuration with a written description of each retention rule.
  • Document how to check policy status, handle failed transitions and restore an index from snapshot.
  • Provide a retention evidence pack that maps each rule to the requirement it satisfies, for review by the client's auditors.

How we support

  • Review lifecycle policies whenever OpenSearch minor releases or plugin changes affect Index State Management behavior.
  • Ongoing support, upgrades and continuous testing are available as a retainer, scoped in writing.
  • Confirm with the client's own platform and compliance teams before changing any retention period or deletion rule.

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.