Assert icon
Request icon
LoopUntil icon
Webhook icon

Reindex OpenSearch with a search canary and atomic read-alias cutover

Reindex a frozen OpenSearch source with native Kestra tasks. Check counts and a search canary before atomic alias cutover; retain the old index for rollback.

Categories
Data

Change OpenSearch mappings without serving a partially built index. Use a frozen concrete source and a single-index read alias owned by this flow.

How it works

  1. Verify the source write block and a plain, single-index alias. Refresh and count the source; empty sources fail before a candidate is created.
  2. Create an execution-specific candidate and start an asynchronous reindex. LoopUntil waits up to ten minutes; all item failures and counts are checked.
  3. Freeze the candidate, check its count and run a configurable search canary.
  4. Recheck the source UUID, write block and alias. Remove the old alias target and add the candidate in one atomic request. Verify the resulting alias.

What you get

  • A read alias moved only after a complete, searchable copy is verified.
  • Old and candidate index names, copied count and per-task API responses.
  • The old index and failed candidates retained for diagnosis or rollback.

Who it's for

Search teams migrating mappings or analyzers during a planned ingestion pause.

Why orchestrate this with Kestra

Native OpenSearch tasks retain copy results and canary outcomes. The bounded wait and explicit gates make a partial reindex fail before alias promotion.

Prerequisites

Kestra 2.0, the OpenSearch plugin, and cluster access. Stop ingestion and set index.blocks.write=true on the concrete source first. No other operator may modify the source or alias during the run. This is a read-alias migration; at cutover both indexes are write-blocked, and the alias has is_write_index=false. Filtered, routed, hidden and multi-index aliases are rejected.

Secrets

  • OPENSEARCH_URL: cluster URL; use trusted TLS for your deployment.
  • OPENSEARCH_USER and OPENSEARCH_PASSWORD: credentials with index read, create, write, settings, reindex/task and alias-management permissions.
  • OPENSEARCH_REINDEX_WEBHOOK_KEY: key for the migration webhook.

Quick start

  1. Configure secrets, source index, read alias and desired mappings.
  2. Pause writers, block source writes, and choose a representative canary. Defaults expect sku, title, price and a title matching wireless.
  3. Execute or call the keyed webhook; verify the new index and alias.

How to extend

Add relevance checks or custom analyzer settings in candidate creation. After failure, inspect or cancel the recorded reindex task before a new execution. Keep enough disk for both copies. Roll back with an atomic alias request to the old index; clean up indexes only after the rollback window. Restrict the webhook to your maintenance caller; update defaults for each new migration.

Links

Share this Blueprint
See How

New to Kestra?

Use blueprints to kickstart your first workflows.