Skip to content

Latest commit

 

History

History
158 lines (107 loc) · 3.62 KB

indexes.md

File metadata and controls

158 lines (107 loc) · 3.62 KB

Indexes

An index is an entity that gathers a set of documents with its own settings.

Learn more about indexes.

List all indexes

List all indexes.

Example

Response: 200 Ok

[
  {
    "uid": "movies",
    "primaryKey": "movie_id",
    "createdAt": "2019-11-20T09:40:33.711324Z",
    "updatedAt": "2019-11-20T10:16:42.761858Z"
  },
  {
    "uid": "movie_reviews",
    "primaryKey": null,
    "createdAt": "2019-11-20T09:40:33.711324Z",
    "updatedAt": "2019-11-20T10:16:42.761858Z"
  }
]

Get one index

Get information about an index.

Path Variables

Variable Description
index_uid The index UID

Example

Response: 200 Ok

{
  "uid": "movies",
  "primaryKey": "movie_id",
  "createdAt": "2019-11-20T09:40:33.711324Z",
  "updatedAt": "2019-11-20T10:16:42.761858Z"
}

Create an index

Create an index.

This route takes as parameter an unique uid and optionally the primary key.

::: note An index is automatically created when adding documents or settings to an index that does not already exist. :::

Body

Variable Description
index_uid The index unique identifier (mandatory)
primaryKey The of the documents
{
  "uid": "movies",
  "primaryKey": "movie_id"
}

Example

Response: 201 created

{
  "uid": "movies",
  "primaryKey": "movie_id",
  "createdAt": "2019-11-20T09:40:33.711476Z",
  "updatedAt": "2019-11-20T09:40:33.711476Z"
}

Update an index

Update an index.

Path Variables

Variable Description
index_uid The index UID

Body

Variable Description
primaryKey The of the documents

The uid of an index cannot be changed. The primaryKey can be added if it does not already exist (to know if it has been set, use the get index route).

There are many ways in MeiliSearch to set the primary key.

Example

Response: 200 Ok

{
  "uid": "movie_review",
  "primaryKey": "movie_review_id",
  "createdAt": "2019-11-20T09:40:33.711324Z",
  "updatedAt": "2019-11-20T10:16:42.761858Z"
}

Delete an index

Delete an index.

Path Variables

Variable Description
index_uid The index UID

Example

Response: 204 No Content