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
Body Required
-
primaryKey string Required
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"
}