Swap Indexes

POST /swap-indexes

Deploy a new version of an index without any downtime for clients by swapping documents, settings, and task history between two indexes. Specifying several swap operations that will be processed in an atomic way is possible.

Headers

  • Content-Type string Required

    Payload content-type

    Value is application/json.

Path parameters

  • taskUid integer Required

    The task identifier

application/json

Body

  • indexes array Required

    The two indexUids to swap in the given operation.

Responses

  • 202 application/json

    Accepted

  • 401 application/json

    Unauthorized

    Hide response attributes Show response attributes object
POST /swap-indexes
curl \
 -X POST https://example.meilisearch.com:7700/swap-indexes \
 -H "Authorization: Bearer $ACCESS_TOKEN" \
 -H "Content-Type: application/json" \
 -d '[{"indexes":["indexA","indexA_new"]},{"indexes":["indexB","indexB_new"]}]'
Request example
# Headers
Content-Type: application/json

# Payload
[
  {
    "indexes": [
      "indexA",
      "indexA_new"
    ]
  },
  {
    "indexes": [
      "indexB",
      "indexB_new"
    ]
  }
]
Response examples (202)
{
  "taskUid": 0,
  "indexUid": null,
  "status": "enqueued",
  "type": "indexSwap",
  "enqueuedAt": "2021-01-01T09:39:00.000000Z"
}
Response examples (401)
{
  "message": "The Authorization header is missing. It must use the bearer authorization method.",
  "code": "missing_authorization_header",
  "type": "auth",
  "link": "https://docs.meilisearch.com/errors#missing_authorization_header"
}