Kvindo™ Cloud Docs


Language

Migrating a cluster

Copy indices from another OpenSearch cluster into a Kvindo Cloud cluster, prove the copy is complete, then point your application at the new one. The script is re-runnable and checkpoints per index, so an interrupted migration resumes instead of starting over.

Step 1 — read the source's index settings, not just the mapping

A mapping on its own is not enough. The most common failure in this migration is an index whose strings use a custom analyzer: the analyzer is declared in settings.index.analysis, and the mapping only names it. Create the target index with the mapping alone and OpenSearch rejects it outright:

So read both, and carry across the settings that define the index's shape — analysis and number_of_shards (immutable once created).

Do not carry number_of_replicas across. A source cluster often runs 2 replicas; a Kvindo Cloud cluster has a platform-managed default of 1 (0 on a single-data-node cluster). Copying 2 leaves one replica unassigned on every new index and the cluster goes yellow — verified on a real cutover, where 7 freshly created indices did exactly that until set back to 1.

Step 2 — create the target index idempotently

Treat resource_already_exists_exception as success. A migration script gets re-run after an interruption, and a create step that refuses to run twice turns a five-minute resume into a manual cleanup.

Step 3 — load

Scroll the source and write with _bulk, keeping the source _id on every document. Set index.refresh_interval to -1 for the duration and restore the value you recorded afterwards — at the default 1s the verify step below reads a partially refreshed index and reports a short count that looks exactly like a failed copy.

Three failures actually happen, and each needs its own handling:

• Rate limiting. Opening many scrolls at once answers 429; an idle scroll answers search_context_missing_exception. Both invalidate the scroll — the retry must recreate it, with backoff and jitter, not re-issue the dead id.

• Partial bulk failures. _bulk answers HTTP 200 even when documents were rejected; the result is in the body's errors flag. A mapper_parsing_exception there means a field's type drifted between source and target — report that document, do not skip it.

• Re-running an index. Safe with the index operation, which overwrites the same _id. Using create instead returns version_conflict_engine_exception for every document already present.

Progress is checkpointed per index, never by document offset: scroll order is not stable, so an index is either finished or redone from the start — which is safe precisely because every write carries the source _id.

Step 4 — quiesce the source, then verify

A scroll over a live index gives no point-in-time consistency, so stop your writers before the final pass and prove they stopped. Take two document counts 30–45 seconds apart and require a zero delta — not "the newest timestamp looks old". A per-index comparison is stricter still: with writers genuinely stopped, no index grows.

Then _refresh and compare GET <index>/_count and the newest @timestamp on both sides. For an index with no @timestamp field, the count alone is the check.

Use index-level endpoints, not _cat/indices: a tenant OpenSearch User has no cluster permissions by design, so cluster-level reads are refused with no permissions for [cluster:monitor/state]. _count, _mapping and _search all work.

Step 4a — the tail that a timestamp cutoff can never close

This is the finding that matters most, and it is not obvious. A copy driven by "documents newer than the target's newest @timestamp" cannot converge, even with writers stopped. A document that reaches the source carrying an older @timestamp than the target already holds — a replayed event, a backfilled batch, a producer with clock skew — sits below the cutoff on every single run and is invisible forever.

On a real cutover this left 13,432 documents across 633 indices after a pass that reported zero errors, and re-running it changed nothing.

Fix it by _seq_no, not by time. A late-arriving document has a high sequence number and an old timestamp, which is exactly the signature to look for. For each index that is still short, read its newest N documents sorted by _seq_no descending, ask the target which of those _ids it has with _mget, and bulk only the absent ones. That closed 13,432 → 48 in one pass of a few minutes, and a second pass took it to 10.

A caution on the last few: deep paging is capped by index.max_result_window (default 10,000), so from+size cannot walk a large index — use the scroll API when the _seq_no window is not enough. And a handful of residual documents is normal: the target is also being written by your application once it is live, so docs.count comparisons drift in both directions.

Step 5 — copy the aliases

If your application queries an alias rather than a concrete index, recreate that alias on the target before cutover, or the switchover breaks queries that were fine a minute earlier. Adding an alias that already exists is a no-op, so this step is safe to re-run.

Step 6 — cut over, and roll back if you must

Point the application at the target cluster's REST endpoint(s) from status.restEndpoints, pin the target's CA (status.caCertificate), and swap the credential for the OpenSearch User's. Keep the alias name unchanged so nothing else has to move.

The copy only ever read from the source, so any failure before this point is recoverable: point the application back at the old cluster, and resume the copy the next day. Nothing has to be undone.

The script

Reads the source settings, creates the target index, loads with retry and a per-index checkpoint, restores the refresh interval, and refuses to mark an index done unless the target's own count matches what it wrote.

How long it takes

Measured on a real migration — source: a managed OpenSearch 2.19.6 cluster with 9,810 indices, 913 M documents, 346 GB; target: a Kvindo Cloud cluster with 2 data nodes and 3 cluster managers running 3.9.0.

Phase Measured
Build the work list (both clusters listed)1–4 s for all 9,810 indices
Per-index cutoffs (newest timestamp each)0.5–3 s
First pass: 1,894 indices, 11.1 M documents behind996.8 s (16.6 min) — 526 ms per index
Second pass: 1,174 indices86.7 s
Third pass: 439 indices37.8 s
Cutover pass with writers stopped: 1,186 indices, 26,445 documents13.4 s — 11 ms per index
Late-arrival tail by _seq_no: 13,432 documents over 633 indices~3 min

Read that table for what it is: the cost is per index, not per document. Passes 2 and 3 moved a fraction of the documents of pass 1 yet still walked every changed index, so the time fell only with the index count — and once writers were stopped it collapsed to 11 ms per index because nothing was left to copy. A full initial load of a large corpus is dominated by bulk throughput instead, and was not measured here — do not scale these numbers by document count.

Traps worth an hour each

• The custom analyzer lives in settings, not the mapping — see step 1

• Copying the source's number_of_replicas turns the cluster yellow — see step 1

• An @timestamp cutoff never converges; the tail needs _seq_no — see step 4a

• Per-index overhead dominates a delta; copying more documents into the same index is cheap, touching more indices is not

• The source rate-limits concurrent scrolls — run in waves rather than opening hundreds at once

• Deep paging stops at index.max_result_window (10,000); use the scroll API beyond that

• On the cluster itself network.host is the node's private IP, so 127.0.0.1:9200 refuses; use the address from status.restEndpoints

• Open file descriptors. Every shard segment a node holds costs descriptors, and a freshly loaded index has many segments before its merges run — so a bulk load is the moment a node runs out. Watch each node's open-descriptor count against its limit, and stop the wave if any node passes 80%. Exhausting them does not fail the load cleanly: shards come back ALLOCATION_FAILED — Too many open files and the cluster goes red

• Shard ceiling. cluster.max_shards_per_node caps how many indices the cluster can hold, and with replicas it is roughly two shards per index on a two-data-node cluster. Check it before a large ingest: a cluster at 9,891 indices against a 20,000 limit has about 100 indices of headroom left. It is cluster state, not a template — raise it with PUT _cluster/settings, and remember a re-created cluster does not inherit it

What this does not do

• Deletes are not propagated. A document deleted on the source after your copy stays in the target. If your data is not append-only, reconcile deletions separately.

• Index templates and lifecycle policies are not copied. Indices created after cutover inherit whatever the target defines, not the source's templates.

• It assumes an append-only source. Verify that before relying on it — step 4 is where you prove it, not where you assume it.

If a shard is stuck ALLOCATION_FAILED, POST _cluster/reroute?retry_failed=true usually clears it once the load has stopped. The stronger escape — allocate_empty_primary with an explicit node and accept_data_loss: true — discards the shard's data. It is acceptable for a system index such as an audit log; it is destructive on a tenant index, and the request body looks the same either way, so check which index you are naming before you run it.

Do not copy the source's system indices (.opendistro-*, .plugins-*, .security, .kibana*). The target's security configuration and system indices are managed by the platform; writing the source's over them would overwrite the cluster's own authorization configuration.


Related pages

Resource docs

An unhandled error has occurred. Reload 🗙