# opensearch-project/index-management architecture

> Architecture diagram of the GitHub repository opensearch-project/index-management, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/opensearch-project/index-management
- Repository: https://github.com/opensearch-project/index-management

## Overview

#### Purpose and runtime
This is a Kotlin/Gradle OpenSearch server plugin for index lifecycle and data-management automation. It runs in OpenSearch nodes, exposes REST and transport actions, persists operational metadata in OpenSearch indices, and schedules background jobs through the Job Scheduler SPI. Build/module entry points are `build.gradle`, `settings.gradle`, and `spi/build.gradle`.

#### Plugin composition and bootstrap
`IndexManagementPlugin` is the primary OpenSearch plugin registration point; it wires REST handlers, transport actions, settings, action filters/interceptors, and feature runners. `IndexManagementRunner` is the scheduler-extension entry point, registered through the Java service descriptor.
- `src/main/kotlin/org/opensearch/indexmanagement/IndexManagementPlugin.kt`
- `src/main/kotlin/org/opensearch/indexmanagement/IndexManagementRunner.kt`
- `src/main/resources/META-INF/services/org.opensearch.jobscheduler.spi.JobSchedulerExtension`

#### Shared SPI boundary
The `spi` Gradle module defines extension contracts and common ISM execution abstractions. It separates pluggable action parsing, metadata access, action execution steps, validation/status checks, and action metrics from the concrete plugin implementation. External extensions can implement `IndexManagementExtension` and contribute ISM behavior.
- `spi/src/main/kotlin/org.opensearch.indexmanagement.spi/IndexManagementExtension.kt`
- `spi/src/main/kotlin/org.opensearch.indexmanagement.spi/indexstatemanagement/Action.kt`
- `spi/src/main/kotlin/org.opensearch.indexmanagement.spi/indexstatemanagement/Step.kt`

#### Index State Management (ISM)
ISM is the central lifecycle engine. Policies model states, actions, transitions, templates, retries, and managed-index configuration. REST handlers delegate to OpenSearch transport actions for policy CRUD, attachment/removal, simulation, explain, and retry. Policies are parsed into concrete actions, validated, then executed as resumable steps.
- `src/main/kotlin/org/opensearch/indexmanagement/indexstatemanagement/model/Policy.kt`
- `src/main/kotlin/org/opensearch/indexmanagement/indexstatemanagement/ManagedIndexCoordinator.kt`
- `src/main/kotlin/org/opensearch/indexmanagement/indexstatemanagement/ManagedIndexRunner.kt`

#### ISM control flow and persistence
The coordinator discovers/sweeps managed indices; the runner loads persisted metadata, selects the current state/action/step, invokes OpenSearch operations, records progress/errors/history, and retries or transitions according to policy. Step implementations encapsulate asynchronous attempt/wait boundaries for operations such as rollover, shrink, snapshots, rollups, and transforms. ISM config/history mappings establish the persisted storage boundary.
- `src/main/kotlin/org/opensearch/indexmanagement/indexstatemanagement/IndexStateManagementHistory.kt`
- `src/main/kotlin/org/opensearch/indexmanagement/indexstatemanagement/step/rollover/AttemptRolloverStep.kt`
- `src/main/resources/mappings/opendistro-ism-config.json`

#### Rollup and transform jobs
Rollup and transform are independently managed scheduled workloads with REST/transport CRUD and lifecycle controls. Their runners execute search/aggregation/indexing pipelines, while metadata services persist job state. ISM actions can create and wait for these jobs, coupling lifecycle policy execution to their completion.
- `src/main/kotlin/org/opensearch/indexmanagement/rollup/RollupRunner.kt`
- `src/main/kotlin/org/opensearch/indexmanagement/rollup/RollupIndexer.kt`
- `src/main/kotlin/org/opensearch/indexmanagement/transform/TransformRunner.kt`
- `src/main/kotlin/org/opensearch/indexmanagement/transform/TransformIndexer.kt`

#### Snapshot management and operational integrations
Snapshot Management uses a dedicated policy state machine for snapshot creation and deletion, controlled through REST/transport APIs and run by `SMRunner`. Notifications support ISM destinations including Slack, Chime, and custom webhooks. Control Center notification filters observe index-operation responses and emit long-running-operation notifications. All integrations execute from within the OpenSearch plugin/security context.
- `src/main/kotlin/org/opensearch/indexmanagement/snapshotmanagement/SMRunner.kt`
- `src/main/kotlin/org/opensearch/indexmanagement/snapshotmanagement/engine/SMStateMachine.kt`
- `src/main/kotlin/org/opensearch/indexmanagement/controlcenter/notification/filter/IndexOperationActionFilter.kt`

Main entry points: [`src/main/kotlin/org/opensearch/indexmanagement/IndexManagementRunner.kt`](https://github.com/opensearch-project/index-management/blob/main/src/main/kotlin/org/opensearch/indexmanagement/IndexManagementRunner.kt) (IndexManagementRunner), [`src/main/kotlin/org/opensearch/indexmanagement/IndexManagementPlugin.kt`](https://github.com/opensearch-project/index-management/blob/main/src/main/kotlin/org/opensearch/indexmanagement/IndexManagementPlugin.kt) (IndexManagementPlugin), [`src/main/kotlin/org/opensearch/indexmanagement/indexstatemanagement/ManagedIndexRunner.kt`](https://github.com/opensearch-project/index-management/blob/main/src/main/kotlin/org/opensearch/indexmanagement/indexstatemanagement/ManagedIndexRunner.kt) (ManagedIndexRunner), [`src/main/kotlin/org/opensearch/indexmanagement/indexstatemanagement/step/rollover/AttemptRolloverStep.kt`](https://github.com/opensearch-project/index-management/blob/main/src/main/kotlin/org/opensearch/indexmanagement/indexstatemanagement/step/rollover/AttemptRolloverStep.kt) (Resumable ISM steps)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["OpenSearch plugin runtime"]
  node_opensearch{{"OpenSearch node<br/>host runtime"}}
  node_plugin["IndexManagementPlugin<br/>plugin bootstrap"]
  node_scheduler_service["Job Scheduler service entry<br/>Java service descriptor"]
  node_scheduler_runner["IndexManagementRunner<br/>scheduler extension"]
  node_spi["Shared SPI contracts<br/>Gradle module"]
  node_notification_filter["IndexOperationActionFilter<br/>operation filter"]
end

subgraph group_ism["Index State Management"]
  node_ism_api["ISM REST and transport APIs<br/>action API"]
  node_policy["ISM policy model<br/>lifecycle model<br/>[Policy.kt]"]
  node_coordinator["ManagedIndexCoordinator<br/>index sweeper"]
  node_managed_runner["ManagedIndexRunner<br/>lifecycle executor"]
  node_steps["Resumable ISM steps<br/>action step"]
  node_ism_storage[("ISM config and history<br/>OpenSearch indices")]
end

subgraph group_jobs["Scheduled workloads"]
  node_rollup_runner["RollupRunner<br/>scheduled runner<br/>[RollupRunner.kt]"]
  node_rollup_indexer["RollupIndexer<br/>aggregation pipeline<br/>[RollupIndexer.kt]"]
  node_transform_runner["TransformRunner<br/>scheduled runner<br/>[TransformRunner.kt]"]
  node_transform_indexer["TransformIndexer<br/>indexing pipeline"]
  node_snapshot_runner["SMRunner<br/>scheduled runner<br/>[SMRunner.kt]"]
  node_snapshot_engine["SMStateMachine<br/>snapshot policy engine<br/>[SMStateMachine.kt]"]
end

node_opensearch -->|"loads"| node_plugin
node_plugin -->|"registers"| node_ism_api
node_plugin -->|"wires features"| node_scheduler_runner
node_scheduler_service -->|"registers"| node_scheduler_runner
node_plugin -->|"uses extension contracts"| node_spi
node_ism_api -->|"manages"| node_policy
node_ism_api -->|"persists metadata"| node_ism_storage
node_scheduler_runner -->|"schedules"| node_coordinator
node_coordinator -->|"dispatches indices"| node_managed_runner
node_managed_runner -->|"evaluates"| node_policy
node_managed_runner -->|"executes"| node_steps
node_managed_runner -->|"loads and records state"| node_ism_storage
node_steps -->|"invokes operations"| node_opensearch
node_scheduler_runner -->|"schedules"| node_rollup_runner
node_rollup_runner -->|"executes"| node_rollup_indexer
node_scheduler_runner -->|"schedules"| node_transform_runner
node_transform_runner -->|"executes"| node_transform_indexer
node_scheduler_runner -->|"schedules"| node_snapshot_runner
node_snapshot_runner -->|"drives"| node_snapshot_engine
node_steps -.->|"creates or waits for jobs"| node_rollup_runner
node_steps -.->|"creates or waits for jobs"| node_transform_runner
node_plugin -->|"registers"| node_notification_filter
node_notification_filter -->|"observes index responses"| node_opensearch

click node_plugin "https://github.com/opensearch-project/index-management/blob/main/src/main/kotlin/org/opensearch/indexmanagement/IndexManagementPlugin.kt"
click node_scheduler_service "https://github.com/opensearch-project/index-management/blob/main/src/main/resources/META-INF/services/org.opensearch.jobscheduler.spi.JobSchedulerExtension"
click node_scheduler_runner "https://github.com/opensearch-project/index-management/blob/main/src/main/kotlin/org/opensearch/indexmanagement/IndexManagementRunner.kt"
click node_spi "https://github.com/opensearch-project/index-management/blob/main/spi/src/main/kotlin/org.opensearch.indexmanagement.spi/IndexManagementExtension.kt"
click node_policy "https://github.com/opensearch-project/index-management/blob/main/src/main/kotlin/org/opensearch/indexmanagement/indexstatemanagement/model/Policy.kt"
click node_coordinator "https://github.com/opensearch-project/index-management/blob/main/src/main/kotlin/org/opensearch/indexmanagement/indexstatemanagement/ManagedIndexCoordinator.kt"
click node_managed_runner "https://github.com/opensearch-project/index-management/blob/main/src/main/kotlin/org/opensearch/indexmanagement/indexstatemanagement/ManagedIndexRunner.kt"
click node_steps "https://github.com/opensearch-project/index-management/blob/main/src/main/kotlin/org/opensearch/indexmanagement/indexstatemanagement/step/rollover/AttemptRolloverStep.kt"
click node_ism_storage "https://github.com/opensearch-project/index-management/blob/main/src/main/resources/mappings/opendistro-ism-config.json"
click node_rollup_runner "https://github.com/opensearch-project/index-management/blob/main/src/main/kotlin/org/opensearch/indexmanagement/rollup/RollupRunner.kt"
click node_rollup_indexer "https://github.com/opensearch-project/index-management/blob/main/src/main/kotlin/org/opensearch/indexmanagement/rollup/RollupIndexer.kt"
click node_transform_runner "https://github.com/opensearch-project/index-management/blob/main/src/main/kotlin/org/opensearch/indexmanagement/transform/TransformRunner.kt"
click node_transform_indexer "https://github.com/opensearch-project/index-management/blob/main/src/main/kotlin/org/opensearch/indexmanagement/transform/TransformIndexer.kt"
click node_snapshot_runner "https://github.com/opensearch-project/index-management/blob/main/src/main/kotlin/org/opensearch/indexmanagement/snapshotmanagement/SMRunner.kt"
click node_snapshot_engine "https://github.com/opensearch-project/index-management/blob/main/src/main/kotlin/org/opensearch/indexmanagement/snapshotmanagement/engine/SMStateMachine.kt"
click node_notification_filter "https://github.com/opensearch-project/index-management/blob/main/src/main/kotlin/org/opensearch/indexmanagement/controlcenter/notification/filter/IndexOperationActionFilter.kt"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_opensearch,node_plugin,node_scheduler_service,node_scheduler_runner,node_spi,node_notification_filter toneBlue
class node_ism_api,node_policy,node_coordinator,node_managed_runner,node_steps,node_ism_storage toneAmber
class node_rollup_runner,node_rollup_indexer,node_transform_runner,node_transform_indexer,node_snapshot_runner,node_snapshot_engine toneMint
```

## Components

### OpenSearch plugin runtime

- **OpenSearch node**: host runtime · Hosts plugin APIs, storage, and scheduler.
- [IndexManagementPlugin](https://github.com/opensearch-project/index-management/blob/main/src/main/kotlin/org/opensearch/indexmanagement/IndexManagementPlugin.kt): plugin bootstrap · Registers REST, transport, settings, filters, and feature runners. · `src/main/kotlin/org/opensearch/indexmanagement/IndexManagementPlugin.kt`
- [Job Scheduler service entry](https://github.com/opensearch-project/index-management/blob/main/src/main/resources/META-INF/services/org.opensearch.jobscheduler.spi.JobSchedulerExtension): Java service descriptor · `src/main/resources/META-INF/services/org.opensearch.jobscheduler.spi.JobSchedulerExtension`
- [IndexManagementRunner](https://github.com/opensearch-project/index-management/blob/main/src/main/kotlin/org/opensearch/indexmanagement/IndexManagementRunner.kt): scheduler extension · Starts plugin-managed scheduled features. · `src/main/kotlin/org/opensearch/indexmanagement/IndexManagementRunner.kt`
- [Shared SPI contracts](https://github.com/opensearch-project/index-management/blob/main/spi/src/main/kotlin/org.opensearch.indexmanagement.spi/IndexManagementExtension.kt): Gradle module · Extension and ISM execution contracts for external contributors. · `spi/src/main/kotlin/org.opensearch.indexmanagement.spi/IndexManagementExtension.kt`
- [IndexOperationActionFilter](https://github.com/opensearch-project/index-management/blob/main/src/main/kotlin/org/opensearch/indexmanagement/controlcenter/notification/filter/IndexOperationActionFilter.kt): operation filter · Emits Control Center notifications for long-running index operations. · `src/main/kotlin/org/opensearch/indexmanagement/controlcenter/notification/filter/IndexOperationActionFilter.kt`

### Index State Management

- **ISM REST and transport APIs**: action API · Policy CRUD, attachment, simulation, explain, and retry operations.
- [ISM policy model](https://github.com/opensearch-project/index-management/blob/main/src/main/kotlin/org/opensearch/indexmanagement/indexstatemanagement/model/Policy.kt): lifecycle model · Defines states, actions, transitions, templates, and retries. · `src/main/kotlin/org/opensearch/indexmanagement/indexstatemanagement/model/Policy.kt`
- [ManagedIndexCoordinator](https://github.com/opensearch-project/index-management/blob/main/src/main/kotlin/org/opensearch/indexmanagement/indexstatemanagement/ManagedIndexCoordinator.kt): index sweeper · Discovers managed indices and schedules their work. · `src/main/kotlin/org/opensearch/indexmanagement/indexstatemanagement/ManagedIndexCoordinator.kt`
- [ManagedIndexRunner](https://github.com/opensearch-project/index-management/blob/main/src/main/kotlin/org/opensearch/indexmanagement/indexstatemanagement/ManagedIndexRunner.kt): lifecycle executor · Resumes policy action steps and records outcomes. · `src/main/kotlin/org/opensearch/indexmanagement/indexstatemanagement/ManagedIndexRunner.kt`
- [Resumable ISM steps](https://github.com/opensearch-project/index-management/blob/main/src/main/kotlin/org/opensearch/indexmanagement/indexstatemanagement/step/rollover/AttemptRolloverStep.kt): action step · Attempt/wait boundaries for OpenSearch operations. · `src/main/kotlin/org/opensearch/indexmanagement/indexstatemanagement/step/rollover/AttemptRolloverStep.kt`
- [ISM config and history](https://github.com/opensearch-project/index-management/blob/main/src/main/resources/mappings/opendistro-ism-config.json): OpenSearch indices · Persists managed-index metadata, progress, errors, and history. · `src/main/resources/mappings/opendistro-ism-config.json`

### Scheduled workloads

- [RollupRunner](https://github.com/opensearch-project/index-management/blob/main/src/main/kotlin/org/opensearch/indexmanagement/rollup/RollupRunner.kt): scheduled runner · Controls rollup job execution. · `src/main/kotlin/org/opensearch/indexmanagement/rollup/RollupRunner.kt`
- [RollupIndexer](https://github.com/opensearch-project/index-management/blob/main/src/main/kotlin/org/opensearch/indexmanagement/rollup/RollupIndexer.kt): aggregation pipeline · Searches, aggregates, and indexes rollup output. · `src/main/kotlin/org/opensearch/indexmanagement/rollup/RollupIndexer.kt`
- [TransformRunner](https://github.com/opensearch-project/index-management/blob/main/src/main/kotlin/org/opensearch/indexmanagement/transform/TransformRunner.kt): scheduled runner · Controls transform job execution. · `src/main/kotlin/org/opensearch/indexmanagement/transform/TransformRunner.kt`
- [TransformIndexer](https://github.com/opensearch-project/index-management/blob/main/src/main/kotlin/org/opensearch/indexmanagement/transform/TransformIndexer.kt): indexing pipeline · Executes transform search and indexing work. · `src/main/kotlin/org/opensearch/indexmanagement/transform/TransformIndexer.kt`
- [SMRunner](https://github.com/opensearch-project/index-management/blob/main/src/main/kotlin/org/opensearch/indexmanagement/snapshotmanagement/SMRunner.kt): scheduled runner · Runs snapshot-management policies. · `src/main/kotlin/org/opensearch/indexmanagement/snapshotmanagement/SMRunner.kt`
- [SMStateMachine](https://github.com/opensearch-project/index-management/blob/main/src/main/kotlin/org/opensearch/indexmanagement/snapshotmanagement/engine/SMStateMachine.kt): snapshot policy engine · Drives snapshot creation and deletion states. · `src/main/kotlin/org/opensearch/indexmanagement/snapshotmanagement/engine/SMStateMachine.kt`

## Connections

- OpenSearch node → IndexManagementPlugin: loads
- IndexManagementPlugin → ISM REST and transport APIs: registers
- IndexManagementPlugin → IndexManagementRunner: wires features
- Job Scheduler service entry → IndexManagementRunner: registers
- IndexManagementPlugin → Shared SPI contracts: uses extension contracts
- ISM REST and transport APIs → ISM policy model: manages
- ISM REST and transport APIs → ISM config and history: persists metadata
- IndexManagementRunner → ManagedIndexCoordinator: schedules
- ManagedIndexCoordinator → ManagedIndexRunner: dispatches indices
- ManagedIndexRunner → ISM policy model: evaluates
- ManagedIndexRunner → Resumable ISM steps: executes
- ManagedIndexRunner → ISM config and history: loads and records state
- Resumable ISM steps → OpenSearch node: invokes operations
- IndexManagementRunner → RollupRunner: schedules
- RollupRunner → RollupIndexer: executes
- IndexManagementRunner → TransformRunner: schedules
- TransformRunner → TransformIndexer: executes
- IndexManagementRunner → SMRunner: schedules
- SMRunner → SMStateMachine: drives
- Resumable ISM steps → RollupRunner: creates or waits for jobs
- Resumable ISM steps → TransformRunner: creates or waits for jobs
- IndexManagementPlugin → IndexOperationActionFilter: registers
- IndexOperationActionFilter → OpenSearch node: observes index responses
