Elasticsearch aliases, from the first index

A mapping change usually cannot be applied in place, so it means a new index — and if the application names the index directly, that is a coordinated deploy in the middle of a reindex.

POST /_aliases
{ "actions": [{ "add": { "index": "orders-v1", "alias": "orders" }}]}

# later, the swap — both actions in ONE request, so it is atomic
POST /_aliases
{ "actions": [
  { "remove": { "index": "orders-v1", "alias": "orders" }},
  { "add":    { "index": "orders-v2", "alias": "orders" }}
]}

Two separate requests leave a window where queries fail, which is the whole reason the atomic form exists. Writes arriving during the reindex are the part needing thought — either dual-write for the duration or reindex again from a timestamp afterwards. Starting every index behind an alias costs nothing on day one and cannot be retrofitted without the downtime it exists to avoid.