cURL

curl \
  -X PATCH 'MEILISEARCH_URL/indexes/movies' \
  -H 'Content-Type: application/json' \
  --data-binary '{ "primaryKey": "id" }'

HTTP Responses

202

401

404

{
  "taskUid": 0,
  "indexUid": "movies",
  "status": "enqueued",
  "type": "indexUpdate",
  "enqueuedAt": "2021-01-01T09:39:00.000000Z"
}

PATCH Request Structure

/
indexes
/
{index_uid}

Authorizations

Authorization

  • Type: string (header)
  • Required: Yes

An API key is a token that you provide when making API calls. Read more about how to secure your project.

Include the API key to the Authorization header, for instance:

-H 'Authorization: Bearer 6436fc5237b0d6e0d64253fbaac21d135012ecf1'

If you use a SDK, ensure you instantiate the client with the API key, for instance with JS SDK:

const client = new Meilisearch({
  host: 'MEILISEARCH_URL',
  apiKey: '6436fc5237b0d6e0d64253fbaac21d135012ecf1'
});

Path Parameters

  • index_uid: string (required) - Unique identifier of the index.

Body

application/json

Request body for updating an existing index

  • primaryKey: string | null - New primary key of the index
  • uid: string | null - New uid for the index (for renaming)

Response

202

application/json

A summarized view of a task, returned when a task is enqueued.

Task Summary

  • taskUid: integer (required) - Unique sequential identifier of the task.
  • status: enum (required) - Status of the task. Possible values are enqueued, processing, succeeded, failed, and canceled.
  • type: enum (required) - Type of operation performed by the task. Available options include documentAdditionOrUpdate, documentEdition, documentDeletion, settingsUpdate, indexCreation, indexDeletion, indexUpdate, etc.
  • enqueuedAt: string (required) - Date and time when the task was enqueued.
  • indexUid: string | null - Unique identifier of the targeted index. Null for global tasks.
  • customMetadata: string | null - Custom metadata attached to this task at creation.