Skip to content

OpenSearch ISM policies

OpenSearch Index State Management (ISM) policies — state machines for rollover, replica adjustment, forcemerge, and deletion. Includes a working logs policy and explain output.

OpenSearch Index State Management (ISM) is the OpenSearch take on Elasticsearch ILM — same goal (time-series index lifecycle), different shape. ISM models each policy as an explicit state machine with named states, transitions, and per-state actions. This article authors a working logs ISM policy, binds it to a write index via the rollover alias, and inspects state with the explain API. Audience is operators running OpenSearch for log analytics.

How to verify

After binding a policy, confirm ISM is managing the index:

curl -sk -u admin:"$PW" 'https://os:9200/_plugins/_ism/policies' | jq '.policies[].policy.policy_id'
curl -sk -u admin:"$PW" 'https://os:9200/_plugins/_ism/explain/logs-*?pretty'
curl -sk -u admin:"$PW" 'https://os:9200/_cat/indices/logs-*?v&s=index'
curl -sk -u admin:"$PW" 'https://os:9200/_plugins/_ism/policies/logs-policy?pretty'

Healthy: indices show a policy_id, a state (hot/warm/cold/delete), and step.name reflects current progress without failed: true.

What’s happening

ISM is a state machine. You declare:

  • States — named buckets (hot, warm, cold, delete) with a list of actions and transitions.
  • Actions — rollover, replica_count, force_merge, index_priority, allocation, read_only, delete, notification, snapshot.
  • Transitions — conditional moves between states (min_index_age, min_doc_count, min_size).

Compared with Elasticsearch ILM:

  • ISM is more explicit. You name the states and transitions; ILM’s phases are fixed (hot/warm/cold/frozen).
  • ISM transitions can have multiple conditions in a list — first to match wins.
  • ISM bindings work via templates (ism_template) and via direct attachment on existing indices.
  • No frozen tier equivalent. OpenSearch doesn’t ship searchable snapshots in the open-source plugin; cold is the lowest tier.

A typical logs policy: start in hot, rollover at 30 GB primary or 7 days, transition to warm (replica=1, forcemerge), then cold (replica=0, read_only), then delete after 180 days.

The procedure

1. Create the ISM policy:

curl -sk -u admin:"$PW" -X PUT 'https://os:9200/_plugins/_ism/policies/logs-policy' \
  -H 'Content-Type: application/json' \
  -d '{
    "policy": {
      "description": "Logs lifecycle: hot 7d -> warm 30d -> cold 180d -> delete",
      "default_state": "hot",
      "ism_template": [{
        "index_patterns": ["logs-*"],
        "priority": 100
      }],
      "states": [
        {
          "name": "hot",
          "actions": [
            {
              "rollover": {
                "min_primary_shard_size": "30gb",
                "min_index_age": "7d"
              }
            }
          ],
          "transitions": [
            {"state_name": "warm", "conditions": {"min_index_age": "7d"}}
          ]
        },
        {
          "name": "warm",
          "actions": [
            {"replica_count": {"number_of_replicas": 1}},
            {"force_merge": {"max_num_segments": 1}},
            {"index_priority": {"priority": 50}}
          ],
          "transitions": [
            {"state_name": "cold", "conditions": {"min_index_age": "30d"}}
          ]
        },
        {
          "name": "cold",
          "actions": [
            {"replica_count": {"number_of_replicas": 0}},
            {"read_only": {}}
          ],
          "transitions": [
            {"state_name": "delete", "conditions": {"min_index_age": "180d"}}
          ]
        },
        {
          "name": "delete",
          "actions": [{"delete": {}}]
        }
      ]
    }
  }'

The ism_template block auto-attaches the policy to new indices matching logs-*, so you don’t need a separate index template for the binding.

2. Create the index template for shard/refresh settings:

curl -sk -u admin:"$PW" -X PUT 'https://os:9200/_index_template/logs-template' \
  -H 'Content-Type: application/json' \
  -d '{
    "index_patterns": ["logs-*"],
    "template": {
      "settings": {
        "number_of_shards": 1,
        "number_of_replicas": 1,
        "refresh_interval": "30s",
        "plugins.index_state_management.rollover_alias": "logs"
      }
    },
    "priority": 200
  }'

3. Bootstrap the write alias:

curl -sk -u admin:"$PW" -X PUT 'https://os:9200/logs-000001' \
  -H 'Content-Type: application/json' \
  -d '{
    "aliases": {
      "logs": {"is_write_index": true}
    }
  }'

Index name pattern must end in -NNNNNN so the rollover action can compute the next index name (logs-000002).

4. Manually attach the policy to an index that doesn’t match the template (e.g. legacy indices):

curl -sk -u admin:"$PW" -X POST 'https://os:9200/_plugins/_ism/add/legacy-2025.12' \
  -H 'Content-Type: application/json' \
  -d '{"policy_id": "logs-policy"}'

5. Inspect state and progress:

curl -sk -u admin:"$PW" 'https://os:9200/_plugins/_ism/explain/logs-000001?pretty'

Look at state.name, action.name, step.name, and step_status. If step_status is failed, the info field contains the failure detail.

6. Retry a failed step:

curl -sk -u admin:"$PW" -X POST 'https://os:9200/_plugins/_ism/retry/logs-000001'

You can also force a state change:

curl -sk -u admin:"$PW" -X POST 'https://os:9200/_plugins/_ism/change_policy/logs-000001' \
  -H 'Content-Type: application/json' \
  -d '{"policy_id": "logs-policy", "state": "warm"}'

Operational notes

  • rollover requires the alias to exist with is_write_index: true — same trap as ILM. Bootstrap correctly or the policy stalls.
  • force_merge blocks the index for the duration of the merge — schedule warm phase transitions during off-peak hours.
  • Transitions check at the ISM job interval (plugins.index_state_management.job_interval, default 5 minutes). Don’t expect sub-minute reactions.
  • replica_count: 0 plus read_only: true is a recipe for data loss on disk failure — pair with snapshots before lowering replicas.
  • Policy edits don’t migrate in-flight indices. When you change a policy, only new attachments use the new spec. Use change_policy to migrate existing indices explicitly.
  • min_size vs min_primary_shard_size — the former is total index size (primary + replicas), the latter is primary only. For rollover always use min_primary_shard_size.

In the engagements we run, ISM is the OpenSearch equivalent of ILM in terms of operational impact — the cluster runs itself once tuned. The explicit state-machine model is easier to debug than ILM’s implicit phase logic, but the templating gotchas are similar. We treat ISM policies as code under source control. See /en/services/managed-operations/ for how we operate OpenSearch clusters with ISM-managed retention.