Update Index

PATCH /indexes/{indexUid}

Update an index. Specify a primaryKey if it doesn't already exists yet.

Headers

  • Content-Type string Required

    Payload content-type

    Value is application/json.

Path parameters

  • indexUid string Required

    Index Unique Identifier

application/json

Responses

  • 202 application/json

    Accepted

  • 400 application/json

    Bad Request

    Hide response attributes Show response attributes object
  • 401 application/json

    Unauthorized

    Hide response attributes Show response attributes object
  • 404

    Not Found

PATCH /indexes/{indexUid}
curl \
 -X PATCH https://example.meilisearch.com:7700/indexes/movies \
 -H "Authorization: Bearer $ACCESS_TOKEN" \
 -H "Content-Type: application/json" \
 -d '{"primaryKey":"string"}'
Request example
# Headers
Content-Type: application/json

# Payload
{
  "primaryKey": "string"
}
Response examples (202)
{
  "taskUid": 0,
  "indexUid": "movies",
  "status": "enqueued",
  "type": "indexUpdate",
  "enqueuedAt": "2021-01-01T09:39:00.000000Z"
}
Response examples (400)
{
  "message": "Index `:indexUid` already has a primary key.",
  "code": "index_primary_key_already_exists",
  "type": "invalid_request",
  "link": "https://docs.meilisearch.com/errors#index_primary_key_already_exists"
}
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"
}