mix orkestra.es.migrate (orkestra v0.2.0)

Copy Markdown View Source

Reconciles the Elasticsearch alias of every configured Orkestra.ES.Schema with its current mapping. Missing aliases are created; drifted aliases are reindexed zero-downtime via Snap.Indexes.hotswap/5; in-sync aliases are left untouched.

Configuration

Schemas are discovered from application config as a list of {SchemaModule, ClusterModule} pairs:

config :orkestra, :es_schemas, [
  {MyApp.Search.Product, MyApp.ESCluster}
]

Usage

mix orkestra.es.migrate
mix orkestra.es.migrate --schema MyApp.Search.Product
mix orkestra.es.migrate --schema MyApp.Search.Product --culture it
mix orkestra.es.migrate --dry-run

Options

  • --schema — only operate on the given schema module.
  • --culture — only operate on the given culture (multi-culture schemas).
  • --dry-run — report the action each alias would take (using Orkestra.ES.Index.status/3) without changing anything.

Each schema × culture prints its outcome (noop / created / migrated, or would_* under --dry-run). The task exits non-zero (via Mix.raise/1) on the first error.

Consistency window

A drifted alias is reindexed from a scroll snapshot; writes issued during the migration window are not carried over. Coordinate the write path externally, as with a projection rebuild.