# Opensearch Migration Operator

> Operates Elasticsearch to OpenSearch migration workflows safely — version compatibility assessment (ES 5.x/6.x/7.x to OpenSearch 1.x/2.x), index migration via snapshot/restore to S3 repository and reindex-from-remote, plugin compatibility (remove ES-only plugins before migration), client compatibility (OpenSearch client vs ES client, compatibility mode), _search API compatibility mode, cluster migration path (in-place upgrade vs new cluster + reindex), snapshot repository setup (S3 repository plugin), downtime planning (blue/green strategy), and OpenSearch 2.x features (neural search, vector DB, flow frameworks). Runs deterministic pre-checks (version compatibility, plugin inventory, snapshot repository health, index mapping compatibility), executes behind a CONFIRM gate, and emits READY, BLOCKED, or COMPLETED per operation with the exact CLI and API sequence. Use for ES-to-OpenSearch migration planning, snapshot repository setup, index reindex, or post-migration verification.

- Skill: `jhkchan/opensearch-migration-operator` (Agent Skill, multi-file: 20 files)
- Install (CLI): `npx get-skill add jhkchan/opensearch-migration-operator`
- Raw SKILL.md: https://api.skillmd.com/api/skills/jhkchan/opensearch-migration-operator/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Integrations & APIs
- License: Apache-2.0
- Author: jhkchan (https://skillmd.com/u/jhkchan)
- Updated: 2026-11-23
- Page: https://skillmd.com/skills/jhkchan/opensearch-migration-operator

---


# OpenSearch Migration Operator

## What this skill does

Executes Elasticsearch to OpenSearch migration operations correctly and
safely. Runs deterministic pre-checks before any state-changing operation,
executes the migration behind a CONFIRM gate, and verifies the result.
Every migration involves version compatibility assessment, plugin
inventory, snapshot repository setup, index migration strategy selection,
and client compatibility verification. A wrong migration path causes
data loss, broken queries, or client connection failures.

## Quick navigation

| Section | What it covers | When to read it |
|---|---|---|
| **Quick reference** | Verdict thresholds + pre-check priority order | Before any operation |
| **STRICT output contract** | Mandatory output block format | Before emitting any response |
| **Mindset** | Version compatibility model, snapshot vs reindex, client compatibility | Understanding the migration model |
| **Pre-flight** | Domain metadata gate — version, plugins, snapshot, indices | Before executing any CLI |
| **Process** | Per-operation planning: assess, snapshot, in-place, new-cluster, blue/green, verify | When choosing which operation to run |
| **Expert heuristic** | Non-obvious ES-to-OpenSearch migration behaviours | Review before complex decisions |
| **NEVER** | Anti-patterns that cause data loss, broken clients, or failed migrations | Review before risky operations |

## Quick reference — verdict thresholds

| Verdict | Trigger condition | Action |
|---|---|---|
| `BLOCKED` | One or more pre-checks failed (incompatible version, ES-only plugin, no snapshot repository, broken index mappings) | List failures, do NOT execute |
| `READY` | All pre-checks passed; awaiting CONFIRM gate | Emit exact CLI/API sequence, wait for operator yes |
| `COMPLETED` | Migration finished and post-verification passed | Emit new cluster info, verification results, client notes |

**Priority order for pre-checks (apply in this sequence, all must pass for
READY):**

1. **Version compatibility** — source ES version must be supported for
   the target OpenSearch version. ES 7.x -> OpenSearch 1.x/2.x is
   supported. ES 5.x/6.x requires intermediate upgrade.
2. **Plugin inventory** — all installed plugins must have OpenSearch
   equivalents. ES-only plugins (e.g., commercial X-Pack plugins) must
   be removed or replaced before migration.
3. **Snapshot repository health** — S3 snapshot repository must be
   registered and writable. Required for snapshot/restore migration.
4. **Index mapping compatibility** — index mappings and settings must be
   compatible with the target OpenSearch version.
5. **Client compatibility** — application clients must support OpenSearch
   or use compatibility mode (`compatible=40`).

**Migration timing baselines (2026):**

- Version compatibility assessment: immediate (API check).
- Snapshot repository setup: 5-15 minutes.
- Full snapshot to S3: 10-120 minutes per TB (depends on network and S3
  write throughput).
- In-place upgrade (ES 7.10 -> OpenSearch 1.x): 30-120 minutes (blue/green
  deployment, AWS-managed).
- Reindex from remote: 1-10 hours per TB (depends on network bandwidth,
  index size, and mapping complexity).
- Blue/green new cluster migration: 2-8 hours total (provision new cluster
  + reindex + cutover).

## STRICT output contract

Every migration response MUST emit this block per target domain. No prose
before or after the block; the block is the entire actionable output.

```text
OPERATION: <assess | snapshot-setup | in-place-upgrade | new-cluster-reindex | blue-green | verify>
VERDICT: READY | BLOCKED | COMPLETED
TARGET: <domain-name, source-version, target-version>
PRE_CHECKS:
  - [PASS] <check description>
  - [FAIL] <check description> — <reason>
STEPS:
  1. <CLI or API command with parameters populated>
  2. <wait command>
  3. <next step>
POST_VERIFY:
  - [PASS] <verification description>
  - [FAIL] <verification description> — <reason>
ENDPOINT: <OpenSearch endpoint behavior>
CLIENT_NOTES: <compatibility mode, client library, connection string updates>
CONFIRM: Before executing any state-changing CLI, emit and await operator
  approval: "CONFIRM: About to <operation> on <domain> in <region>.
  Proceed? (yes/no)"
```

Do NOT omit any field. If a field is not applicable, write `N/A` with a
one-line reason.

## Mindset

**One-line takeaway:** ES-to-OpenSearch migration is not a version bump —
it is a fork migration. OpenSearch 1.x derives from ES 7.10.2 (the last
Apache 2.0 licensed version). OpenSearch 2.x diverges further. The
migration path depends on the source version, installed plugins, and
client library.

Driven by four migration realities:

- **Version compatibility determines the path.** ES 7.x can upgrade
  in-place to OpenSearch 1.x (same codebase lineage). ES 5.x/6.x must
  upgrade to 7.x first, then to OpenSearch. Skipping versions requires
  a new cluster + reindex migration. AWS-managed ES domains support
  in-place upgrade to OpenSearch for eligible versions only.

- **Snapshot/restore is the safest migration method.** Register an S3
  repository on both source and target, take a snapshot on the source,
  and restore on the target. This preserves index mappings, settings,
  and data without reindexing. Reindex-from-remote is the fallback when
  snapshot/restore is not possible (e.g., cross-version with breaking
  mapping changes).

- **Plugins are the #1 migration blocker.** ES-only plugins (commercial
  X-Pack features: security, ML, SQL, alerting) do not exist in
  OpenSearch. OpenSearch has its own equivalents (security plugin,
  anomaly detection, SQL plugin, alerting plugin), but their APIs and
  configurations differ. Inventory plugins before planning the migration.

- **Client compatibility mode bridges the gap.** OpenSearch servers can
  respond with `compatible=40` header to mimic ES 7.x responses. This
  allows existing ES client libraries (elasticsearch-py, elasticsearch-js,
  Spring Data Elasticsearch) to work without code changes. But it is a
  bridge, not a permanent solution — migrate to the OpenSearch client
  library for long-term compatibility.

## Pre-flight: domain metadata gate

Run before classification. Misclassifying these produces wrong plans.

> Moved verbatim to [references/diagnostic-commands.md](references/diagnostic-commands.md) — load on demand.
> Read it only when this section applies.

**Malformed input:** if the input is invalid or missing required fields,
emit `VERDICT: BLOCKED` with `REASON: Domain/operation configuration is
not valid or is missing required fields — cannot plan.`

| Domain attribute | Effect on migration |
|---|---|
| `EngineVersion: Elasticsearch_7.10` | Can upgrade in-place to OpenSearch 1.x or 2.x. |
| `EngineVersion: Elasticsearch_6.x or 5.x` | Must upgrade to 7.x first or use new-cluster + reindex. |
| `EngineVersion: OpenSearch_2.x` | Already on OpenSearch — verify post-migration. |
| ES-only plugins installed | Must remove or replace before migration. |
| No snapshot repository configured | BLOCKED for snapshot/restore migration — set up S3 repository first. |
| Cluster status `red` | BLOCKED — fix cluster health before migration. |
| Cluster status `yellow` | Warn — replica shards unavailable; migration proceeds but verify. |
| Dedicated masters enabled | AWS manages blue/green deployment; in-place upgrade is smoother. |
| EncryptionAtRest enabled | KMS key follows the domain; no migration impact. |
| VPC-only domain | Endpoint is internal; client access requires VPC connectivity. |

## Process — operation planning (apply in order)

### Step 0: Expert heuristic — non-obvious ES-to-OpenSearch migration behaviours
> Moved verbatim to [references/advanced-patterns.md](references/advanced-patterns.md) — load on demand.
> Read it only when this section applies.


### Step 1: Pre-check gate — BLOCKED if any check fails

Run ALL of the following pre-checks. If ANY fails, the verdict is BLOCKED
with the failed checks enumerated in PRE_CHECKS. Do NOT execute.

**For ALL migration operations:**
1. Domain status is `Active` (not `Processing`, `Upgrading`).
2. Cluster health is `green` or `yellow` (not `red`).
3. No active index creation, shard relocation, or recovery in progress.
4. IAM role for the operator holds `es:ESHttp*` and
   `opensearch:ESHttp*` permissions.

**For version compatibility assessment:**
5. Source ES version is identified (5.x, 6.x, 7.x, or OpenSearch 1.x).
6. Target OpenSearch version is identified (1.x or 2.x).
7. Version compatibility matrix is checked (see § Version compatibility
   matrix below).

**For snapshot/restore migration:**
5. S3 bucket exists and is accessible.
6. IAM role has `s3:ListBucket`, `s3:GetObject`, `s3:PutObject` on the
   bucket.
7. Snapshot repository plugin is installed (repository-s3 for
   self-managed; automatic for AWS-managed).
8. Repository is registered on both source and target clusters.
9. Test snapshot write/read succeeds.

**For in-place upgrade:**
5. Source version is ES 7.10 (the only version eligible for direct
   in-place upgrade to OpenSearch on AWS).
6. No ES-only commercial plugins installed.
7. Domain has dedicated masters enabled (recommended for blue/green
   deployment).
8. EBS volume size has headroom for reindexing during upgrade.

**For new-cluster + reindex migration:**
5. Target OpenSearch domain is provisioned and accessible.
6. Network connectivity exists between source and target (especially for
   VPC-only domains).
7. Target indices created with correct mappings and settings.
8. Reindex-from-remote is enabled on the target cluster
   (`"reindex.remote.whitelist": "<source-endpoint>:443"`).

**For client compatibility verification:**
5. Application client library version is identified.
6. Compatibility mode (`compatible=40`) tested against target cluster.
7. All application API calls tested against OpenSearch endpoints.

### Step 2: Version compatibility matrix

| Source version | Target version | Migration path | Risk |
|---|---|---|---|
| ES 5.x | OpenSearch 1.x | Upgrade to ES 6.x -> 7.x -> OS 1.x (multiple steps) | HIGH |
| ES 5.x | OpenSearch 2.x | New cluster + reindex (no direct path) | HIGH |
| ES 6.x | OpenSearch 1.x | Upgrade to ES 7.x -> OS 1.x | MEDIUM |
| ES 6.x | OpenSearch 2.x | New cluster + reindex | MEDIUM |
| ES 7.x | OpenSearch 1.x | In-place upgrade (direct fork lineage) | LOW |
| ES 7.x | OpenSearch 2.x | In-place to OS 1.x -> upgrade to OS 2.x | LOW-MEDIUM |
| OpenSearch 1.x | OpenSearch 2.x | In-place upgrade | LOW |
| OpenSearch 2.x | OpenSearch 2.x (newer) | In-place upgrade | LOW |

### Step 3: Plugin compatibility assessment

| ES plugin | OpenSearch equivalent | Action |
|---|---|---|
| analysis-icu, phonetic, kuromoji, smartcn | Built-in | No action — pre-installed on OpenSearch |
| ingest-attachment | Built-in | No action — pre-installed |
| mapper-murmur3, annotated-text | Built-in | No action — pre-installed |
| x-pack-security | OpenSearch security plugin | Migrate security config (config.yml, roles.yml) |
| x-pack-ml | OpenSearch anomaly detection | Reconfigure ML jobs |
| x-pack-sql | OpenSearch SQL plugin | Update API paths (`_plugins/_sql`) |
| x-pack-alerting | OpenSearch alerting plugin | Reconfigure monitors and destinations |
| x-pack-monitoring | OpenSearch performance analyzer | Reconfigure monitoring |

### Step 4: Snapshot repository setup (S3)

If the migration uses snapshot/restore, the S3 repository must be set up
on both source and target.

**For AWS-managed domains:** the S3 repository is configured via the
domain's snapshot configuration. AWS automatically manages the
repository-s3 plugin.

```json
PUT _snapshot/s3-migration-repo
{
  "type": "s3",
  "settings": {
    "bucket": "migration-snapshots-bucket",
    "region": "us-east-1",
    "base_path": "opensearch-migration",
    "role_arn": "arn:aws:iam::111111111111:role/OpenSearchSnapshotRole"
  }
}
```

**Verify the repository:**
```
POST _snapshot/s3-migration-repo/_verify
```

Returns the list of nodes that can write to the repository. All data
nodes must report `success`.

### Step 5: Snapshot and restore migration

On the source cluster, create a snapshot:
```
PUT _snapshot/s3-migration-repo/snapshot_1?wait_for_completion=true
{"indices":"index1,index2,index3","ignore_unavailable":true,"include_global_state":false}
```

On the target cluster, register the same repository, then restore:
```
POST _snapshot/s3-migration-repo/snapshot_1/_restore?wait_for_completion=false
{"indices":"index1,index2,index3","ignore_unavailable":true,"include_global_state":false,"rename_pattern":"(.+)","rename_replacement":"$1"}
```

Monitor restore progress: `GET _cat/recovery?v` and
`GET _cluster/health?wait_for_status=green&timeout=60s`.

### Step 6: Reindex-from-remote migration

When snapshot/restore is not possible (cross-major-version, incompatible
mappings), use reindex-from-remote.

On the target cluster, reindex from the remote source:
```
POST _reindex?wait_for_completion=false
{"source":{"remote":{"host":"https://search-source-es-cluster.us-east-1.es.amazonaws.com:443"},"index":"source-index","size":5000},"dest":{"index":"target-index"}}
```

**IMPORTANT:** The target index must be created with the correct mappings
and settings BEFORE reindexing. Reindex does NOT copy mappings or
settings from the source.

**For AWS-managed VPC domains:** the target domain's security group must
allow inbound HTTPS from the source domain's VPC, or use VPC peering /
Transit Gateway for cross-VPC connectivity.

### Step 7: In-place upgrade (ES 7.10 to OpenSearch)

For AWS-managed domains, the in-place upgrade is triggered via:

```bash
aws opensearch update-domain-config \
  --domain-name prod-search-cluster \
  --engine-version OpenSearch_2.11 \
  --region us-east-1
```

AWS performs a blue/green deployment:
1. Provisions new nodes with OpenSearch.
2. Migrates data from old nodes to new nodes.
3. Routes traffic to the new nodes.
4. Decommissions the old nodes.

The domain endpoint does NOT change. Monitor the upgrade status:

```bash
aws opensearch describe-domain \
  --domain-name prod-search-cluster \
  --query 'DomainStatus.{Status:Processing, UpgradeProcessing:UpgradeProcessing, EngineVersion:EngineVersion}' \
  --output json
```

### Step 8: Blue/green new cluster migration

For complex migrations (multiple version jumps, plugin incompatibilities),
provision a new OpenSearch domain and migrate indices.

**Strategy:**
1. Provision new OpenSearch domain.
2. Register S3 snapshot repository on both clusters.
3. Snapshot all indices from the source.
4. Restore on the target.
5. Verify data completeness (document counts, mapping fidelity).
6. Update application connection strings to the new endpoint.
7. Decommission the source cluster after a verification window.

**Downtime:** Near-zero if the source cluster remains read-write during
the migration. Applications write to the source; reindex or snapshot-
restore copies data; final cutover requires a brief write freeze for
delta sync.

### Step 9: Client compatibility verification

After migration, verify that application clients work correctly against
the OpenSearch endpoint.

| Client library | Compatibility | Action |
|---|---|---|
| elasticsearch-py/js/go 7.x | Works with `compatible=40` | Long-term: migrate to opensearch-* equivalent |
| Spring Data Elasticsearch | Works with `compatible=40` | Long-term: migrate to Spring Data OpenSearch |
| opensearch-py / @opensearch-project/opensearch | Native OpenSearch | No action needed |

**Testing procedure:** Point the application at the OpenSearch endpoint
with `?compatible=40`. Run the integration test suite. Verify search
results match the ES baseline. Test index, update, and delete operations.
Aggregation queries are the most likely to differ — test them first.

### Step 10: Post-verification — COMPLETED

After the migration finishes, run post-verification. ALL checks must pass
for `COMPLETED`.

1. Cluster health is `green` on the target OpenSearch domain.
2. Document counts match between source and target indices.
3. Index mappings are preserved or correctly migrated.
4. All application search queries return correct results.
5. Client compatibility mode (`compatible=40`) works for existing ES
   clients.
6. Snapshot repository is registered and functional on the target.
7. No red shards or unassigned replicas.
8. Monitoring and alerting are configured on the target domain.

If ANY verification fails, emit `VERDICT: ERROR` with failure details —
do not claim COMPLETED.

## Output format

See § STRICT output contract for the mandatory block. Worked examples
below.

### Worked example — migration readiness assessment (READY)

```text
OPERATION: assess
VERDICT: READY
TARGET: prod-search-cluster (ES 7.10 -> OpenSearch 2.11)
PRE_CHECKS:
  - [PASS] Domain status is Active
  - [PASS] Cluster health is green (45 indices, 12 TB)
  - [PASS] Source version Elasticsearch_7.10 is eligible for in-place upgrade
  - [PASS] All installed plugins (analysis-icu, analysis-phonetic, ingest-attachment) have OpenSearch equivalents
  - [PASS] No ES-only commercial plugins detected
  - [PASS] No active shard relocation or recovery in progress
STEPS:
  1. Set up S3 snapshot repository (if not already configured):
     PUT _snapshot/s3-migration-repo {"type":"s3","settings":{"bucket":"migration-snapshots","region":"us-east-1","base_path":"opensearch-migration"}}
  2. Take a pre-upgrade full snapshot:
     PUT _snapshot/s3-migration-repo/pre-upgrade-snapshot?wait_for_completion=true {"indices":"*","ignore_unavailable":true,"include_global_state":true}
  3. CONFIRM: About to update-domain-config on prod-search-cluster to OpenSearch_2.11. Blue/green deployment will take 30-120 minutes. Proceed? (yes/no)
  4. aws opensearch update-domain-config --domain-name prod-search-cluster --engine-version OpenSearch_2.11 --region us-east-1
  5. Monitor: aws opensearch describe-domain --domain-name prod-search-cluster --query 'DomainStatus.{Processing:Processing,EngineVersion:EngineVersion}'
POST_VERIFY: (pending execution)
ENDPOINT: https://search-prod-search-cluster.us-east-1.es.amazonaws.com (unchanged — AWS blue/green preserves the endpoint)
CLIENT_NOTES:
  - OpenSearch 2.11 supports compatible=40 for ES 7.x clients.
  - Test all application search queries with compatibility mode before full cutover.
  - Plan to migrate client libraries from elasticsearch-* to opensearch-* within 3-6 months.
```

> Secondary worked examples moved verbatim to [references/worked-examples.md](references/worked-examples.md) — load on demand.
> Read them only when the primary example is not sufficient.






## Expert heuristic — non-obvious ES-to-OpenSearch migration behaviours
> Moved verbatim to [references/advanced-patterns.md](references/advanced-patterns.md) — load on demand.
> Read it only when this section applies.


## Anti-Patterns — NEVER (top 5)

1. NEVER start a migration without a verified snapshot. If the migration
   fails or corrupts data, the snapshot is the only rollback path. Always
   take a full snapshot before any in-place upgrade or reindex operation.
   Verify the snapshot repository with `_verify` before trusting it.

2. NEVER attempt an in-place upgrade with ES-only commercial plugins
   installed. X-Pack plugins (security, ML, SQL, alerting) do not exist
   in OpenSearch. The upgrade will fail or produce a broken cluster.
   Inventory plugins with `_cat/plugins` and remove or replace ES-only
   plugins before migration.

3. NEVER skip the version compatibility matrix check. ES 5.x/6.x cannot
   upgrade directly to OpenSearch — skipping versions requires a new
   cluster + reindex migration. Attempting an unsupported version jump
   results in a failed upgrade or data format incompatibility.

4. NEVER assume client compatibility without testing. The `compatible=40`
   header makes OpenSearch respond like ES 7.x, but it does NOT replicate
   ES-specific API endpoints (`_xpack/*`). Test every application API
   call against the target before cutover. Aggregation queries are the
   most likely to differ.

5. NEVER decommission the source cluster immediately after migration.
   Keep the source running for a verification window (minimum 7 days
   recommended). If post-migration issues are discovered, the source
   cluster is the fallback. Decommission only after all verification
   checks pass and the team confirms the new cluster handles production
   traffic.

## Pre-flight safety checks (run before any migration CLI)
> Moved verbatim to [references/diagnostic-commands.md](references/diagnostic-commands.md) — load on demand.
> Read it only when this section applies.


## Recent AWS features (2024-2026)
> Moved verbatim to [references/advanced-patterns.md](references/advanced-patterns.md) — load on demand.
> Read it only when this section applies.


## References

- `references/migration-procedures.md` — detailed CLI/API scripts for
  snapshot setup, reindex-from-remote, plugin inventory, and
  post-migration verification
- [references/worked-examples.md](references/worked-examples.md) — secondary worked examples (BLOCKED, COMPLETED, snapshot READY)
- [references/diagnostic-commands.md](references/diagnostic-commands.md) — pre-flight gather commands and pre-flight safety checks
- [references/advanced-patterns.md](references/advanced-patterns.md) — Step 0 expert behaviours, expert heuristics, recent AWS features

## Domain

AWS CloudOps / Elasticsearch to OpenSearch Migration Operations.

## AWS documentation

- **Amazon OpenSearch Service Developer Guide** — https://docs.aws.amazon.com/opensearch-service/latest/developerguide/what-is.html
- **Upgrading Amazon OpenSearch Service** — https://docs.aws.amazon.com/opensearch-service/latest/developerguide/version-maturity.html
- **Migrating to Amazon OpenSearch Service** — https://docs.aws.amazon.com/opensearch-service/latest/developerguide/migration.html
- **Snapshot management in OpenSearch Service** — https://docs.aws.amazon.com/opensearch-service/latest/developerguide/managedomains-snapshots.html
- **OpenSearch-compatible APIs** — https://docs.aws.amazon.com/opensearch-service/latest/developerguide/use-casees.html
- **OpenSearch Plugin Reference** — https://docs.aws.amazon.com/opensearch-service/latest/developerguide/supported-plugins.html
- **OpenSearch documentation** — https://opensearch.org/docs/latest/
- **OpenSearch version compatibility** — https://opensearch.org/docs/latest/upgrade-to/upgrade-to/
- **OpenSearch neural search** — https://opensearch.org/docs/latest/search-plugins/neural-search/
- **OpenSearch k-NN (vector DB)** — https://opensearch.org/docs/latest/search-plugins/knn/index/
- **OpenSearch flow frameworks** — https://opensearch.org/docs/latest/observing-your-data/flow-framework/
- **AWS CLI OpenSearch reference** — https://docs.aws.amazon.com/cli/latest/reference/opensearch/
- **AWS Well-Architected Framework — Operational Excellence** — https://docs.aws.amazon.com/wellarchitected/latest/operational-excellence-pillar/welcome.html

