Chapter 17 · Index Lifecycle: Elastic ILM/Data Tiers and OpenSearch ISM

Lifecycle Policy Versioning, Safe Testing, Stuck Actions, Manual Intervention, and Compliance Retention

Version lifecycle policies safely, test state transitions, diagnose stuck actions, intervene without corrupting lifecycle state, and make retention deletion conditional on compliance and recoverability evidence.

Intermediate → Advanced115–150 minutesLifecycle automation & retention labElasticsearch 9.5.3 · OpenSearch 3.8.0Last reviewed: September 2026

Learning outcomes

Lifecycle policies change while indices are already moving through them. AtlasMart therefore needs a deployment discipline: version policies, simulate/test first, understand when updates take effect, diagnose stuck work, retry only after repair, and keep compliance deletion gates external to blind automation.

01

Explain Elastic cached-phase policy updates and OpenSearch ISM policy/OCC change behavior.

02

Promote policy changes through deterministic fixtures rather than editing production first.

03

Diagnose stuck ILM/ISM actions from controller state plus allocation/disk/permission evidence.

04

Use retry/change-policy/manual-intervention APIs only within their safety boundaries.

05

Make retention automation subordinate to legal hold, verified backup/restore, and deletion evidence.

Chapter baseline reviewed 11 September 2026

Examples target self-managed Elasticsearch 9.5.3 / Kibana 9.5.3 and OpenSearch 3.8.0 / OpenSearch Dashboards 3.8.0. AtlasMart keeps https://localhost:9200 for Elasticsearch with CA verification and https://localhost:9201 for the disposable OpenSearch demo certificate using OPENSEARCH_INITIAL_ADMIN_PASSWORD. Existing containers remain atlasmart-es and atlasmart-os. The lifecycle lab uses isolated aliases atlasmart-life-es and atlasmart-life-os, one primary shard and zero replicas so a single-node local lab can run; that topology is not production guidance. OpenSearch demo -k is local-only. No moving latest tags are used.

Lifecycle systems are not interchangeable

Elastic ILM is a phase/action engine integrated with Elastic data tiers. OpenSearch ISM is a plugin state machine with states, ordered actions and transitions. Similar goals such as rollover and deletion do not make policy JSON, policy-update timing, tier semantics, troubleshooting APIs, permissions, managed-service behavior, or feature availability portable.

Execution note

The generation environment does not run the AtlasMart Docker containers. Commands below are reproducible lab instructions, while response snippets are explicitly labeled expected shapes/invariants rather than fabricated measurements. Measure your own transition timing, I/O, CPU, merge time, p95/p99 search latency and storage consumption.

1. Versioning means more than naming files v2

A lifecycle artifact should be source-controlled with an application-level version and promoted like schema/code. But the server also has its own version/concurrency behavior. Elasticsearch increments ILM policy version when the policy is updated; managed indices may continue using cached phase definitions. OpenSearch policy documents expose _seq_no and _primary_term for optimistic-concurrency updates, and a managed index may still be executing an older attached policy version.

Question Elastic ILM OpenSearch ISM
How do policy edits propagate? safe edits may update cached current phase; unsafe retroactive changes wait for phase progression small config changes may apply next execution; state/action/order changes can be queued until state completion
Concurrency on policy document policy replacement increments version update uses if_seq_no + if_primary_term
See running definition ILM explain phase_execution/version ISM explain show_policy + policy version metadata
Preview change disposable index + explain; no generic mutation-free ILM simulator ISM simulate supports stored/inline policy preview

2. Safe promotion workflow

Lifecycle policy CI/promotion checklist
1. Parse policy JSON and lint destructive actions.
2. Verify exact index/data-stream/alias match set.
3. Create a disposable generation with production-like settings.
4. Apply/attach the candidate policy only to the fixture.
5. Simulate where the product supports it; otherwise use explain + dry design review.
6. Trigger safe small rollover/transition conditions.
7. Observe controller state, allocation, segment/merge, disk, CPU and latency.
8. Test one deliberate recoverable failure (for example a missing rollover alias).
9. Repair the cause; retry through supported API.
10. Confirm deletion is disabled or far-future until compliance/restore gates pass.
11. Promote policy with immutable change record and rollback instructions.

The most important test is not “policy accepted.” It is whether the controller reaches the intended state while the cluster still meets availability, recovery, latency and compliance criteria.

3. Deliberately create a safe stuck rollover

On a disposable index only, remove or misconfigure the rollover alias so the controller cannot roll over. Then inspect controller state. The purpose is to learn that a lifecycle error is a symptom; the repair is the underlying alias/allocation/configuration fix.

Elastic observation and retry after repair
GET atlasmart-life-es-000001/_ilm/explain?human
GET atlasmart-life-es-000001/_alias
# Repair the alias/template/root cause first.
POST atlasmart-life-es-000001/_ilm/retry
GET atlasmart-life-es-000001/_ilm/explain?human
OpenSearch observation and retry after repair
GET _plugins/_ism/explain/atlasmart-life-os-000001?show_policy=true&validate_action=true
GET atlasmart-life-os-000001/_alias
# Repair the rollover alias/root cause first.
POST _plugins/_ism/retry/atlasmart-life-os-000001
GET _plugins/_ism/explain/atlasmart-life-os-000001?show_policy=true

Never retry repeatedly under unresolved disk-watermark, permission, allocation or alias failures. That converts a clear safety signal into operational noise.

4. Policy changes and manual intervention

Elastic protects current phase execution by caching phase definitions. A policy edit that cannot be safely applied retroactively does not magically rewrite the current phase. OpenSearch change_policy is asynchronous; changes that alter state/actions/order can wait until the current state completes. This design prevents abrupt mid-action state corruption.

Wrong pattern: “unstick” by forcibly jumping to delete.

Elastic’s move-to-step API can execute a lifecycle step and is documented as potentially destructive. OpenSearch change-policy can explicitly select a target state. Both require change control, confirmed current state, and a proof that the action is safe. A manual state jump is not a substitute for fixing a broken policy.

5. Compliance retention is an external invariant

A lifecycle engine knows index age and policy state, not the full legal/business context. A legal hold, investigation, contractual retention extension or failed backup can invalidate deletion even when the age condition is true. AtlasMart therefore defines a deletion gate outside the lifecycle JSON: policy release approval requires retention authority, legal-hold check, verified restore evidence where mandated, and auditable ownership.

Evidence before deletion Why
retention/compliance date age alone may not equal legal eligibility
legal-hold state active hold must override normal expiration
snapshot/restore verification if required a snapshot name is not proof of usable recovery
index/alias/data-stream scope avoid deleting unrelated generations
policy explain state prove the controller is deleting the intended object
owner/change record support audit and incident reconstruction

6. Cleanup and bridge

Remove only Chapter 17 disposable resources
DELETE _index_template/atlasmart-life-es-template-v1
DELETE _ilm/policy/atlasmart-life-es-v1
DELETE atlasmart-life-es-*

DELETE _index_template/atlasmart-life-os-template-v1
DELETE _plugins/_ism/policies/atlasmart-life-os-v1
DELETE atlasmart-life-os-*

If a policy is still attached to an index, remove/stop management in the product-supported order before deleting the policy. Do not delete shared AtlasMart telemetry/data-stream fixtures from earlier chapters.

The next lesson turns the two implementations into one intent-level portability matrix.

Check your understanding

  1. Why can an ILM policy edit fail to affect an index already in a phase?
  2. How should an OpenSearch policy document be updated safely?
  3. What should happen before retrying a failed lifecycle action?
  4. Why is manual state movement high risk?
  5. Why is index age insufficient for compliance deletion?
Review the answers

1. The phase definition is cached; only safe changes are applied retroactively.

2. Use the current seq_no and primary_term so stale updates fail instead of silently overwriting newer policy state.

3. Repair the actual alias/allocation/disk/permission/policy cause and then retry.

4. It can execute destructive actions or bypass assumptions that normal state progression would enforce.

5. Legal holds, contracts, backup/restore obligations and ownership approvals can override a simple age condition.

Summary

Lifecycle automation is deployed software. Version it, test it, observe its running state, repair causes before retry, and never let the controller become the sole authority for irreversible deletion.

Authoritative references

Keep knowledge open

Help the academy stay free and grow.

If these tutorials save you time, a small donation supports new lessons, technical review, diagrams, examples, and long-term maintenance.

ETHEthereum / ERC-20 only
0x716c4Ab160C4B66F31a28AE2448BfF68fc3a2ef0

Send only Ethereum or ERC-20 compatible assets to this address.