/indexes
route allows you to create, manage, and delete your indexes.
Learn more about indexes.
Index object
Name | Type | Default value | Description |
---|---|---|---|
uid | String | N/A | Unique identifier of the index. Once created, it cannot be changed |
createdAt | String | N/A | Creation date of the index, represented in RFC 3339 format. Auto-generated on index creation |
updatedAt | String | N/A | Latest date of index update, represented in RFC 3339 format. Auto-generated on index creation or update |
primaryKey | String / null | null | Primary key of the index. If not specified, Meilisearch guesses your primary key from the first document you add to the index |
List all indexes
GET
/indexes
offset
and limit
query parameters.
Query parameters
Query parameter | Description | Default value |
---|---|---|
offset | Number of indexes to skip | 0 |
limit | Number of indexes to return | 20 |
Response
Name | Type | Description |
---|---|---|
results | Array | An array of indexes |
offset | Integer | Number of indexes skipped |
limit | Integer | Number of indexes returned |
total | Integer | Total number of indexes |
Example
Response: 200 Ok
Get one index
GET
/indexes/{index_uid}
Path parameters
Name | Type | Description |
---|---|---|
index_uid * | String | uid of the requested index |
Example
Response: 200 Ok
Create an index
POST
/indexes
Body
Name | Type | Default value | Description |
---|---|---|---|
uid * | String | N/A | uid of the requested index |
primaryKey | String / null | null | Primary key of the requested index |
Example
Response: 202 Accepted
taskUid
to track the status of your request.
Update an index
PATCH
/indexes/{index_uid}
It is not possible to change an index’s
uid
.Path parameters
Name | Type | Description |
---|---|---|
index_uid * | String | uid of the requested index |
Body
Name | Type | Default value | Description |
---|---|---|---|
primaryKey * | String / null | N/A | Primary key of the requested index |
Example
Response: 202 Accepted
taskUid
to track the status of your request.
Delete an index
DELETE
/indexes/{index_uid}
Path parameters
Name | Type | Description |
---|---|---|
index_uid * | String | uid of the requested index |
Example
Response: 202 Accepted
taskUid
to track the status of your request.
Swap indexes
POST
/swap-indexes
indexA
and indexB
will also replace every mention of indexA
by indexB
and vice-versa in the task history. enqueued
tasks are left unmodified.
To learn more about index swapping, refer to this short guide.
Body
An array of objects. Each object has only one key:indexes
.
Name | Type | Default value | Description |
---|---|---|---|
indexes * | Array of strings | N/A | Array of the two indexUid s to be swapped |
indexes
array must contain only two elements: the indexUid
s of the two indexes to be swapped. Sending an empty array ([]
) is valid, but no swap operation will be performed.
You can swap multiple pairs of indexes with a single request. To do so, there must be one object for each pair of indexes to be swapped.
Example
Response
Since
indexSwap
is a global task, the indexUid
is always null
.taskUid
to track the status of your request.