Esc
ZeroIndex
GuidesAPI referenceSDKsChangelogOverviewBuy ZeroIndex

Swap indexes

View as MarkdownThe page as plain text

Swap the documents and settings of two indexes in one step, to replace a live index without downtime.

POST/v1/swap-indexes

Build the new version in a separate index, then swap. Searches move over in one step, so users never see empty or half imported results. See Syncing a database. Requires an admin key.

Body

[].indexesstring[2]required

The two indexes to swap. Send several pairs to swap them all in one task.

Request

curl https://api.zeroindex.test/v1/swap-indexes \
  -H "Authorization: Bearer $ZEROINDEX_KEY" \
  -d '[{ "indexes": ["products", "products_new"] }]'
const task = await client.swapIndexes([{ indexes: ["products", "products_new"] }]);
task = client.swap_indexes([{"indexes": ["products", "products_new"]}])

Response

202
{
  "taskUid": 8840,
  "indexUid": null,
  "status": "enqueued",
  "type": "indexSwap",
  "enqueuedAt": "2026-10-17T07:58:30Z"
}