MeiliSearch Core API

Search documents, configure and manage the MeiliSearch engine.

This is the documentation for version 0.22.0 of the API. Last update on Sep 13, 2021.

This API is provided under license MIT.

Base URL
https://example.meilisearch.com:7700

Authentication

Send an authentication token in the X-Meili-API-Key header to authenticate with the API.


Indexes

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

List Indexes

List all indexes.

Responses
  • 200 array[object]

    Ok

    • uid Required / string

      Unique identifier for the index

    • name Required / string

      Name of the index

    • primaryKey

      Custom primaryKey for documents

    • createdAt Required / string
    • updatedAt Required / string
  • 401 object

    Unauthorized

    • message Required / string
    • errorCode Required / string
    • errorType Required / string
    • errorLink Required / string
GET /indexes
$ curl \
 -X GET https://example.meilisearch.com:7700/indexes
Response example (200)
[
  {
    "uid": "movies",
    "name": "movies",
    "primaryKey": "movie_id",
    "createdAt": "2019-11-20T09:40:33.711324Z",
    "updatedAt": "2019-11-20T09:40:33.711324Z"
  }
]
Response example (401)
{
  "message": "You must have an authorization token",
  "errorCode": "missing_authorization_header",
  "errorType": "authentication_error",
  "errorLink": "https://docs.meilisearch.com/errors#missing_authorization_header"
}

Create Index

Create an index.

Body
  • uid Required / string
  • primaryKey string
  • Additional properties are NOT allowed
Responses
  • 201 object

    Created

    • uid Required / string

      Unique identifier for the index

    • name Required / string

      Name of the index

    • primaryKey

      Custom primaryKey for documents

    • createdAt Required / string
    • updatedAt Required / string
    • Additional properties are NOT allowed
  • 400 object

    Bad Request

    • message Required / string
    • errorCode Required / string
    • errorType Required / string
    • errorLink Required / string
  • 401 object

    Unauthorized

    • message Required / string
    • errorCode Required / string
    • errorType Required / string
    • errorLink Required / string
POST /indexes
$ curl \
 -X POST https://example.meilisearch.com:7700/indexes \
 -H "Content-Type: application/json" \
 -d '{"uid":"movies","primaryKey":"movie_id"}'
Request payload example
{
  "uid": "movies",
  "primaryKey": "movie_id"
}
Response example (400)
{
  "message": "Index already exists.",
  "errorCode": "index_already_exists",
  "errorType": "invalid_request_error",
  "errorLink": "https://docs.meilisearch.com/errors#index_already_exists"
}
Response example (401)
{
  "message": "You must have an authorization token",
  "errorCode": "missing_authorization_header",
  "errorType": "authentication_error",
  "errorLink": "https://docs.meilisearch.com/errors#missing_authorization_header"
}

Get Index

Get information about an index.

Responses
  • 200 object

    OK

    • uid Required / string

      Unique identifier for the index

    • name Required / string

      Name of the index

    • primaryKey

      Custom primaryKey for documents

    • createdAt Required / string
    • updatedAt Required / string
    • Additional properties are NOT allowed
  • 401 object

    Unauthorized

    • message Required / string
    • errorCode Required / string
    • errorType Required / string
    • errorLink Required / string
  • 404

    Not Found

GET /indexes/{indexUid}
$ curl \
 -X GET https://example.meilisearch.com:7700/indexes/{indexUid}
Response example (200)
{
  "uid": "movies",
  "name": "movies",
  "primaryKey": "movie_id",
  "createdAt": "2019-11-20T09:40:33.711324Z",
  "updatedAt": "2019-11-20T09:40:33.711324Z"
}
Response example (401)
{
  "message": "You must have an authorization token",
  "errorCode": "missing_authorization_header",
  "errorType": "authentication_error",
  "errorLink": "https://docs.meilisearch.com/errors#missing_authorization_header"
}

Update Index

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

Body
  • primaryKey Required / string
  • Additional properties are NOT allowed
Responses
  • 200 object

    Ok

    • uid Required / string

      Unique identifier for the index

    • name Required / string

      Name of the index

    • primaryKey

      Custom primaryKey for documents

    • createdAt Required / string
    • updatedAt Required / string
    • Additional properties are NOT allowed
  • 400 object

    Bad Request

    • message Required / string
    • errorCode Required / string
    • errorType Required / string
    • errorLink Required / string
  • 401 object

    Unauthorized

    • message Required / string
    • errorCode Required / string
    • errorType Required / string
    • errorLink Required / string
  • 404

    Not Found

PUT /indexes/{indexUid}
$ curl \
 -X PUT https://example.meilisearch.com:7700/indexes/{indexUid} \
 -H "Content-Type: application/json" \
 -d '{"primaryKey":"string"}'
Request payload example
{
  "primaryKey": "string"
}
Response example (400)
{
  "message": "A primary key is already present. It's impossible to update it",
  "errorCode": "primary_key_already_present",
  "errorType": "invalid_request_error",
  "errorLink": "https://docs.meilisearch.com/errors#primary_key_already_present"
}
Response example (401)
{
  "message": "You must have an authorization token",
  "errorCode": "missing_authorization_header",
  "errorType": "authentication_error",
  "errorLink": "https://docs.meilisearch.com/errors#missing_authorization_header"
}

Delete Index

Delete an index.

Responses
  • 204

    No Content

  • 401 object

    Unauthorized

    • message Required / string
    • errorCode Required / string
    • errorType Required / string
    • errorLink Required / string
  • 404

    Not Found

DELETE /indexes/{indexUid}
$ curl \
 -X DELETE https://example.meilisearch.com:7700/indexes/{indexUid}
Response example (401)
{
  "message": "You must have an authorization token",
  "errorCode": "missing_authorization_header",
  "errorType": "authentication_error",
  "errorLink": "https://docs.meilisearch.com/errors#missing_authorization_header"
}

Documents

Documents are objects composed of fields that can store any type of data.
Each field contains an attribute and its associated value.
Documents are stored inside indexes.
Learn more about documents.

Get Documents

Get documents by batch.

Query parameters
  • limit number

    Maximum number of documents to return.

    Default value is 20.

  • offset number

    Number of documents to skip.

    Default value is 0.

  • attributesToRetrieve array[string]

    Comma-separated list of attributes whose fields will be present in the returned documents. Defaults to the displayedAttributes list which contains by default all attributes found in the documents.

    Default value is *.

Responses
  • 200 array[object]

    Ok

    • Additional properties are allowed
  • 401 object

    Unauthorized

    • message Required / string
    • errorCode Required / string
    • errorType Required / string
    • errorLink Required / string
  • 404

    Not Found

GET /indexes/{indexUid}/documents
$ curl \
 -X GET https://example.meilisearch.com:7700/indexes/{indexUid}/documents
Response example (200)
[
  {
    "id": 25684,
    "title": "American Ninja 5",
    "poster": "https://image.tmdb.org/t/p/w1280/iuAQVI4mvjI83wnirpD8GVNRVuY.jpg",
    "overview": "When a scientists daughter is kidnapped, American Ninja, attempts to find her, but this time he teams up with a youngster he has trained in the ways of the ninja.",
    "release_date": "1993-01-01"
  }
]
Response example (401)
{
  "message": "You must have an authorization token",
  "errorCode": "missing_authorization_header",
  "errorType": "authentication_error",
  "errorLink": "https://docs.meilisearch.com/errors#missing_authorization_header"
}

Add or update documents

Add a list of documents or update them if they already exist.

If you send an already existing document (same id) the old document will be only partially updated according to the fields of the new document. Thus, any fields not present in the new document are kept and remained unchanged.

To completely overwrite a document, see Add or replace documents route.

If the provided index does not exist, it will be created.

Body
  • Additional properties are allowed
Responses
  • 202 object

    Accepted

    • updateId Required / number

      This updateId allows you to track the current update.

    • Additional properties are NOT allowed
  • 401 object

    Unauthorized

    • message Required / string
    • errorCode Required / string
    • errorType Required / string
    • errorLink Required / string
  • 413 object

    Payload Too Large

    • message Required / string
    • errorCode Required / string
    • errorType Required / string
    • errorLink Required / string
PUT /indexes/{indexUid}/documents
$ curl \
 -X PUT https://example.meilisearch.com:7700/indexes/{indexUid}/documents \
 -H "Content-Type: application/json" \
 -d '[{"id":25684,"title":"American Ninja 5","poster":"https://image.tmdb.org/t/p/w1280/iuAQVI4mvjI83wnirpD8GVNRVuY.jpg","overview":"When a scientists daughter is kidnapped, American Ninja, attempts to find her, but this time he teams up with a youngster he has trained in the ways of the ninja.","release_date":"1993-01-01"}]'
Request payload example
[
  {
    "id": 25684,
    "title": "American Ninja 5",
    "poster": "https://image.tmdb.org/t/p/w1280/iuAQVI4mvjI83wnirpD8GVNRVuY.jpg",
    "overview": "When a scientists daughter is kidnapped, American Ninja, attempts to find her, but this time he teams up with a youngster he has trained in the ways of the ninja.",
    "release_date": "1993-01-01"
  }
]
Response example (202)
{
  "updateId": 1
}
Response example (401)
{
  "message": "You must have an authorization token",
  "errorCode": "missing_authorization_header",
  "errorType": "authentication_error",
  "errorLink": "https://docs.meilisearch.com/errors#missing_authorization_header"
}
Response example (413)
{
  "message": "Payload reached size limit.",
  "errorCode": "payload_too_large",
  "errorType": "invalid_request_error",
  "errorLink": "https://docs.meilisearch.com/errors#payload_too_large"
}

Add or replace documents

Add a list of documents or replace them if they already exist.

If you send an already existing document (same id) the whole existing document will be overwritten by the new document. Fields previously in the document not present in the new document are removed.

For a partial update of the document see Add or update documents route.

If the provided index does not exist, it will be created.

Responses
  • 202 object

    Accepted

    • updateId Required / number

      This updateId allows you to track the current update.

    • Additional properties are NOT allowed
  • 401 object

    Unauthorized

    • message Required / string
    • errorCode Required / string
    • errorType Required / string
    • errorLink Required / string
  • 413 object

    Payload Too Large

    • message Required / string
    • errorCode Required / string
    • errorType Required / string
    • errorLink Required / string
POST /indexes/{indexUid}/documents
$ curl \
 -X POST https://example.meilisearch.com:7700/indexes/{indexUid}/documents \
 -H "Content-Type: application/json"
Response example (202)
{
  "updateId": 1
}
Response example (401)
{
  "message": "You must have an authorization token",
  "errorCode": "missing_authorization_header",
  "errorType": "authentication_error",
  "errorLink": "https://docs.meilisearch.com/errors#missing_authorization_header"
}
Response example (413)
{
  "message": "Payload reached size limit.",
  "errorCode": "payload_too_large",
  "errorType": "invalid_request_error",
  "errorLink": "https://docs.meilisearch.com/errors#payload_too_large"
}

Delete all documents

Delete all documents in the specified index.

Responses
  • 202 object

    Accepted

    • updateId Required / number

      This updateId allows you to track the current update.

    • Additional properties are NOT allowed
  • 401 object

    Unauthorized

    • message Required / string
    • errorCode Required / string
    • errorType Required / string
    • errorLink Required / string
  • 404

    Not Found

DELETE /indexes/{indexUid}/documents
$ curl \
 -X DELETE https://example.meilisearch.com:7700/indexes/{indexUid}/documents
Response example (202)
{
  "updateId": 1
}
Response example (401)
{
  "message": "You must have an authorization token",
  "errorCode": "missing_authorization_header",
  "errorType": "authentication_error",
  "errorLink": "https://docs.meilisearch.com/errors#missing_authorization_header"
}

Delete documents

Delete a selection of documents based on array of document id's.

Responses
  • 202 object

    Accepted

    • updateId Required / number

      This updateId allows you to track the current update.

    • Additional properties are NOT allowed
  • 401 object

    Unauthorized

    • message Required / string
    • errorCode Required / string
    • errorType Required / string
    • errorLink Required / string
  • 404

    Not Found

POST /indexes/{indexUid}/documents/delete-batch
$ curl \
 -X POST https://example.meilisearch.com:7700/indexes/{indexUid}/documents/delete-batch \
 -H "Content-Type: application/json" \
 -d '[1,2,3,"a string id"]'
Request payload example
[
  1,
  2,
  3,
  "a string id"
]
Response example (202)
{
  "updateId": 1
}
Response example (401)
{
  "message": "You must have an authorization token",
  "errorCode": "missing_authorization_header",
  "errorType": "authentication_error",
  "errorLink": "https://docs.meilisearch.com/errors#missing_authorization_header"
}

Get one document

Get one document using its unique id.

Responses
  • 200 object

    Ok

    • Additional properties are allowed
  • 401 object

    Unauthorized

    • message Required / string
    • errorCode Required / string
    • errorType Required / string
    • errorLink Required / string
  • 404

    Not Found

GET /indexes/{indexUid}/documents/{documentId}
$ curl \
 -X GET https://example.meilisearch.com:7700/indexes/{indexUid}/documents/{documentId}
Response example (200)
{
  "id": 25684,
  "title": "American Ninja 5",
  "poster": "https://image.tmdb.org/t/p/w1280/iuAQVI4mvjI83wnirpD8GVNRVuY.jpg",
  "overview": "When a scientists daughter is kidnapped, American Ninja, attempts to find her, but this time he teams up with a youngster he has trained in the ways of the ninja.",
  "release_date": "1993-01-01"
}
Response example (401)
{
  "message": "You must have an authorization token",
  "errorCode": "missing_authorization_header",
  "errorType": "authentication_error",
  "errorLink": "https://docs.meilisearch.com/errors#missing_authorization_header"
}

Delete one document

Delete one document based on its unique id.

Responses
  • 202 object

    Accepted

    • updateId Required / number

      This updateId allows you to track the current update.

    • Additional properties are NOT allowed
  • 401 object

    Unauthorized

    • message Required / string
    • errorCode Required / string
    • errorType Required / string
    • errorLink Required / string
  • 404

    Not Found

DELETE /indexes/{indexUid}/documents/{documentId}
$ curl \
 -X DELETE https://example.meilisearch.com:7700/indexes/{indexUid}/documents/{documentId}
Response example (202)
{
  "updateId": 1
}
Response example (401)
{
  "message": "You must have an authorization token",
  "errorCode": "missing_authorization_header",
  "errorType": "authentication_error",
  "errorLink": "https://docs.meilisearch.com/errors#missing_authorization_header"
}

Search

MeiliSearch exposes 2 routes to perform searches:

  • A POST route: this is the preferred route when using API authentication, as it allows preflight request caching and better performances.
  • A GET route: the usage of this route is discouraged, unless you have good reason to do otherwise (specific caching abilities for example). Other than the differences mentioned above, the two routes are strictly equivalent.

Search

Search for documents matching a specific query in the given index.

This route should only be used when no API key is required. If an API key is required, use the POST route instead.

Query parameters
  • q string

    Query string.

    Default value is "".

  • attributesToRetrieve array[string]

    Comma-separated list of attributes whose fields will be present in the returned documents. Defaults to the displayedAttributes list which contains by default all attributes found in the documents.

    Default value is *.

  • attributesToHighlight array[string]

    Comma-separated list of attributes whose values will contain highlighted matching terms. Highlighted attributes are returned in _formatted response object.

  • attributesToCrop string

    Comma-separated list of attributes whose values have to be cropped. Cropped attributes are returned in _formatted response object.

  • cropLength integer

    Length used to crop field values.

    Default value is 200.

  • facetsDistribution string

    Comma-separated list of attributes whose fields will be distributed as a facet. If you have set up filterableAttributes, you can retrieve the count of matching terms for each facets.Learn more about facet distribution in the dedicated guide

  • filter

    Attribute(s) to filter on.

    Can be made of 3 syntaxes

    • Nested Array: ["something > 1", "genres=comedy", ["genres=horror", "title=batman"]]
    • String: something > 1 AND genres=comedy AND (genres=horror OR title=batman)
    • Mixed: ["something > 1 AND genres=comedy", "genres=horror OR title=batman"]

    Attribute(s) used in filter should be declared as filterable attributes. See Filtering and Faceted Search.

  • offset number

    Number of documents to skip.

    Default value is 0.

  • sort string

    Fields on which you want to sort the results.

    Attribute(s) used in sort should be declared as sortable attributes. See Sorting.

  • limit number

    Maximum number of documents to return.

    Default value is 20.

  • matches boolean

    Defines whether an _matchesInfo object that contains information about the matches should be returned or not.

    Default value is false.

Responses
  • 200 object

    Ok

    • hits array[object]

      Array of documents matching the search.

      • _formatted object

        Only present if attributesToHighlight/attributesToCrop is not empty. Return highlighted and cropped fields.

        • Additional properties are allowed
      • _matchesInfo object

        Only present if matches = true. Array of all search query occurrences in all fields.

        • object

          Starting position and length in bytes of the matched term in the returned value

          • start Required / integer
          • length Required / integer
          • Additional properties are NOT allowed
      • attribute

        Retrieve attributes of the document. attributesToRetrieve controls these fields.

      • Additional properties are allowed
    • offset Required / integer

      Number of documents skipped.

    • limit Required / integer

      Number of returned documents.

    • nbHits Required / integer

      Total number of candidates for this search in the database.

    • exhaustiveNbHits Required / boolean

      Whether nbHits is exhaustive.

    • facetsDistribution object
      • Additional properties: object
        • Additional properties: integer
    • exhaustiveFacetsCount boolean

      Whether facetsDistribution is exhaustive.

    • processingTimeMs Required / integer

      Processing time of the query.

    • query Required / string

      Query originating the response.

    • Additional properties are NOT allowed
  • 401 object

    Unauthorized

    • message Required / string
    • errorCode Required / string
    • errorType Required / string
    • errorLink Required / string
  • 404

    Not Found

GET /indexes/{indexUid}/search
$ curl \
 -X GET https://example.meilisearch.com:7700/indexes/{indexUid}/search
Response example (200)
{
  "hits": [
    {
      "id": 25684,
      "title": "American Ninja 5",
      "poster": "https://image.tmdb.org/t/p/w1280/iuAQVI4mvjI83wnirpD8GVNRVuY.jpg",
      "overview": "When a scientists daughter is kidnapped, American Ninja, attempts to find her, but this time he teams up with a youngster he has trained in the ways of the ninja.",
      "release_date": "1993-01-01",
      "_formatted": {
        "id": 25684,
        "title": "American Ninja 5",
        "poster": "https://image.tmdb.org/t/p/w1280/iuAQVI4mvjI83wnirpD8GVNRVuY.jpg",
        "overview": "When a scientists daughter is kidnapped, American <em>Ninja</em>, attempts to find her, but this time he teams up with a youngster he has trained in the ways of the <em>ninja</em>.",
        "release_date": "1993-01-01"
      },
      "_matchesInfo": {
        "overview": [
          {
            "start": 49,
            "length": 5
          },
          {
            "start": 155,
            "length": 5
          }
        ]
      }
    }
  ],
  "limit": 0,
  "offset": 0,
  "nbHits": 0,
  "query": "string",
  "exhaustiveNbHits": true,
  "processingTimeMs": 0
}
Response example (401)
{
  "message": "You must have an authorization token",
  "errorCode": "missing_authorization_header",
  "errorType": "authentication_error",
  "errorLink": "https://docs.meilisearch.com/errors#missing_authorization_header"
}

Search

Search for documents matching a specific query in the given index.

This is the preferred route to perform search when an API key is required, as it allows for preflight requests to be cached. Caching preflight requests improves considerably the speed of the search.

Body
  • q string

    Query string.

    Default value is "".

  • attributesToRetrieve array[string]

    Array of attributes whose fields will be present in the returned documents. Defaults to the displayedAttributes list which contains by default all attributes found in the documents.

    Default value is ["*"].

  • attributesToHighlight array[string]

    Array of attributes whose values will contain highlighted matching terms. Highlighted attributes are returned in _formatted response object.

    Default value is [].

  • attributesToCrop array[string]

    Array of attributes whose values have to be cropped. Cropped attributes are returned in _formatted response object.

    Default value is [].

  • cropLength number

    Length used to crop field values.

    Default value is 200.

  • matches boolean

    Defines whether an _matchesInfo object that contains information about the matches should be returned or not.

  • filter

    Attribute(s) to filter on.

    Can be made of 3 syntaxes

    • Nested Array: ["something > 1", "genres=comedy", ["genres=horror", "title=batman"]]
    • String: "something > 1 AND genres=comedy AND (genres=horror OR title=batman)"
    • Mixed: ["something > 1 AND genres=comedy", "genres=horror OR title=batman"]

    Attribute(s) used in filter should be declared as filterable attributes. See Filtering and Faceted Search.

  • facetsDistribution array[string]

    Array of attributes whose fields will be distributed as a facet. If you have set up filterableAttributes, you can retrieve the count of matching terms for each facets.Learn more about facet distribution in the dedicated guide

    Default value is [].

  • offset number

    Number of documents to skip.

    Default value is 0.

  • limit number

    Maximum number of documents returned.

    Default value is 20.

  • sort

    Fields on which you want to sort the results.

    Attribute(s) used in sort should be declared as sortable attributes. See Sorting.

  • Additional properties are NOT allowed
Responses
  • 200 object

    Ok

    • hits array[object]

      Array of documents matching the search.

      • _formatted object

        Only present if attributesToHighlight/attributesToCrop is not empty. Return highlighted and cropped fields.

        • Additional properties are allowed
      • _matchesInfo object

        Only present if matches = true. Array of all search query occurrences in all fields.

        • object

          Starting position and length in bytes of the matched term in the returned value

          • start Required / integer
          • length Required / integer
          • Additional properties are NOT allowed
      • attribute

        Retrieve attributes of the document. attributesToRetrieve controls these fields.

      • Additional properties are allowed
    • offset Required / integer

      Number of documents skipped.

    • limit Required / integer

      Number of returned documents.

    • nbHits Required / integer

      Total number of candidates for this search in the database.

    • exhaustiveNbHits Required / boolean

      Whether nbHits is exhaustive.

    • facetsDistribution object
      • Additional properties: object
        • Additional properties: integer
    • exhaustiveFacetsCount boolean

      Whether facetsDistribution is exhaustive.

    • processingTimeMs Required / integer

      Processing time of the query.

    • query Required / string

      Query originating the response.

    • Additional properties are NOT allowed
  • 401 object

    Unauthorized

    • message Required / string
    • errorCode Required / string
    • errorType Required / string
    • errorLink Required / string
  • 404

    Not Found

POST /indexes/{indexUid}/search
$ curl \
 -X POST https://example.meilisearch.com:7700/indexes/{indexUid}/search \
 -H "Content-Type: application/json" \
 -d '{"q":"Harry","offset":0,"limit":20,"filter":"(genres = Horror AND genres = Mystery) OR release_date \u003e 523242000","facetsDistribution":["genres","author"],"attributesToRetrieve":["title","overview"],"attributesToCrop":["overview"],"cropLength":20,"attributesToHighlight":["overview"],"matches":true}'
Request payload example
{
  "q": "Harry",
  "offset": 0,
  "limit": 20,
  "filter": "(genres = Horror AND genres = Mystery) OR release_date > 523242000",
  "facetsDistribution": [
    "genres",
    "author"
  ],
  "attributesToRetrieve": [
    "title",
    "overview"
  ],
  "attributesToCrop": [
    "overview"
  ],
  "cropLength": 20,
  "attributesToHighlight": [
    "overview"
  ],
  "matches": true
}
Response example (200)
{
  "hits": [
    {
      "id": 25684,
      "title": "American Ninja 5",
      "poster": "https://image.tmdb.org/t/p/w1280/iuAQVI4mvjI83wnirpD8GVNRVuY.jpg",
      "overview": "When a scientists daughter is kidnapped, American Ninja, attempts to find her, but this time he teams up with a youngster he has trained in the ways of the ninja.",
      "release_date": "1993-01-01",
      "_formatted": {
        "id": 25684,
        "title": "American Ninja 5",
        "poster": "https://image.tmdb.org/t/p/w1280/iuAQVI4mvjI83wnirpD8GVNRVuY.jpg",
        "overview": "When a scientists daughter is kidnapped, American <em>Ninja</em>, attempts to find her, but this time he teams up with a youngster he has trained in the ways of the <em>ninja</em>.",
        "release_date": "1993-01-01"
      },
      "_matchesInfo": {
        "overview": [
          {
            "start": 49,
            "length": 5
          },
          {
            "start": 155,
            "length": 5
          }
        ]
      }
    }
  ],
  "limit": 0,
  "offset": 0,
  "nbHits": 0,
  "query": "string",
  "exhaustiveNbHits": true,
  "processingTimeMs": 0
}
Response example (401)
{
  "message": "You must have an authorization token",
  "errorCode": "missing_authorization_header",
  "errorType": "authentication_error",
  "errorLink": "https://docs.meilisearch.com/errors#missing_authorization_header"
}

Updates

The updates route gives information about the progress of the asynchronous processes.

Get all update status

Get the status of all updates in a given index.

Responses
  • 200 array[object]

    Ok

    • status Required / string

      The status of the operation.

      Values are enqueued, processing, processed, and failed.

    • updateId Required / integer

      The id of the update.

    • type Required / object

      Type object for the update task

      • name Required / string

        Name of operation

        Values are DocumentAddition, Settings, DocumentsDeletion, ClearAll, and DocumentsPartial.

      • number integer

        Number of documents impacted when the information can be given.

        • synonyms Required / object

          List of associated words treated similarly. A word associated to an array of word as synonyms.

        • stopWords Required / array[string]

          List of words ignored when present in search queries.

        • rankingRules Required / array[string]

          List of ranking rules sorted by order of importance. The order is customizable.

          A list of ordered built-in ranking rules.

        • filterableAttributes Required / array[string]

          Attributes to use for facetting and filtering. See Filtering and Faceted Search.

        • distinctAttribute Required / string

          Search returns documents with distinct (different) values of the given field.

        • searchableAttributes Required / array[string]

          Fields in which to search for matching query words sorted by order of importance.

        • displayedAttributes Required / array[string]

          Fields displayed in the returned documents.

        • Additional properties are NOT allowed
      • Additional properties are NOT allowed
    • enqueuedAt Required / string
    • processedAt string
    • duration number

      The number of seconds taken to complete the operation.

    • error string

      A string describing the error that occurred.

  • 401 object

    Unauthorized

    • message Required / string
    • errorCode Required / string
    • errorType Required / string
    • errorLink Required / string
  • 404

    Not Found

GET /indexes/{indexUid}/updates
$ curl \
 -X GET https://example.meilisearch.com:7700/indexes/{indexUid}/updates
Response example (200)
[
  {
    "status": "processed",
    "updateId": 0,
    "type": {
      "name": "DocumentsAddition",
      "number": 6
    },
    "duration": 0.031,
    "enqueuedAt": "2021-07-05T12:59:17.035788Z",
    "processedAt": "2021-07-05T12:59:17.067453Z"
  },
  {
    "status": "processed",
    "updateId": 1,
    "type": {
      "name": "DocumentsAddition",
      "number": 6
    },
    "duration": 0.043,
    "enqueuedAt": "2021-07-06T07:45:49.883179Z",
    "processedAt": "2021-07-06T07:45:49.927102Z"
  },
  {
    "status": "processed",
    "updateId": 2,
    "type": {
      "name": "Settings",
      "settings": {
        "searchableAttributes": [
          "name",
          "genre"
        ],
        "stopWords": [
          "of",
          "the"
        ],
        "synonyms": {
          "HP": [
            "Harry Potter"
          ],
          "harry potter": [
            "HP"
          ]
        },
        "distinctAttribute": "name"
      }
    },
    "duration": 0.042,
    "enqueuedAt": "2021-07-19T15:21:44.984611Z",
    "processedAt": "2021-07-19T15:21:45.027818Z"
  }
]
Response example (401)
{
  "message": "You must have an authorization token",
  "errorCode": "missing_authorization_header",
  "errorType": "authentication_error",
  "errorLink": "https://docs.meilisearch.com/errors#missing_authorization_header"
}

Get an update status

Get the status of an update in a given index.

Responses
  • 200 object

    Ok

    • status Required / string

      The status of the operation.

      Values are enqueued, processing, processed, and failed.

    • updateId Required / integer

      The id of the update.

    • type Required / object

      Type object for the update task

      • name Required / string

        Name of operation

        Values are DocumentAddition, Settings, DocumentsDeletion, ClearAll, and DocumentsPartial.

      • number integer

        Number of documents impacted when the information can be given.

        • synonyms Required / object

          List of associated words treated similarly. A word associated to an array of word as synonyms.

        • stopWords Required / array[string]

          List of words ignored when present in search queries.

        • rankingRules Required / array[string]

          List of ranking rules sorted by order of importance. The order is customizable.

          A list of ordered built-in ranking rules.

        • filterableAttributes Required / array[string]

          Attributes to use for facetting and filtering. See Filtering and Faceted Search.

        • distinctAttribute Required / string

          Search returns documents with distinct (different) values of the given field.

        • searchableAttributes Required / array[string]

          Fields in which to search for matching query words sorted by order of importance.

        • displayedAttributes Required / array[string]

          Fields displayed in the returned documents.

        • Additional properties are NOT allowed
      • Additional properties are NOT allowed
    • enqueuedAt Required / string
    • processedAt string
    • duration number

      The number of seconds taken to complete the operation.

    • error string

      A string describing the error that occurred.

    • Additional properties are NOT allowed
  • 401 object

    Unauthorized

    • message Required / string
    • errorCode Required / string
    • errorType Required / string
    • errorLink Required / string
  • 404

    Not Found

GET /indexes/{indexUid}/updates/{updateId}
$ curl \
 -X GET https://example.meilisearch.com:7700/indexes/{indexUid}/updates/{updateId}
Response example (401)
{
  "message": "You must have an authorization token",
  "errorCode": "missing_authorization_header",
  "errorType": "authentication_error",
  "errorLink": "https://docs.meilisearch.com/errors#missing_authorization_header"
}

Keys

Each instance of MeiliSearch has three keys: a master, a private, and a public. Each key has a given set of permissions on the API routes.
You must have the master key to access the keys route.
More information about the keys and their rights.

Get keys

Get the private and public key.

Responses
  • 200 object

    Ok

    • private Required / string
    • public Required / string
    • Additional properties are NOT allowed
  • 401 object

    Unauthorized

    • message Required / string
    • errorCode Required / string
    • errorType Required / string
    • errorLink Required / string
GET /keys
$ curl \
 -X GET https://example.meilisearch.com:7700/keys
Response example (200)
{
  "private": "string",
  "public": "string"
}
Response example (401)
{
  "message": "You must have an authorization token",
  "errorCode": "missing_authorization_header",
  "errorType": "authentication_error",
  "errorLink": "https://docs.meilisearch.com/errors#missing_authorization_header"
}

Settings

Settings is a list of all the customization possible for an index.
It is possible to update all the settings in one go or individually with the dedicated routes. Updates in the settings route are partial. This means that any parameters not provided in the body will be left unchanged.
Updating the settings means overwriting the default settings of MeiliSearch. You can reset to default values using the DELETE routes.

Get settings

Get the settings of an index.

Learn more about the settings.

Responses
  • 200 object

    Ok

    • rankingRules Required / array[string]

      List of ranking rules sorted by order of importance. The order is customizable.

      A list of ordered built-in ranking rules.

    • distinctAttribute Required / string

      Search returns documents with distinct (different) values of the given field.

    • searchableAttributes Required / array[string]

      Fields in which to search for matching query words sorted by order of importance.

    • displayedAttributes Required / array[string]

      Fields displayed in the returned documents.

    • stopWords Required / array[string]

      List of words ignored when present in search queries.

    • synonyms Required / object

      List of associated words treated similarly. A word associated to an array of word as synonyms.

    • filterableAttributes Required / array[string]

      Attributes to use for facetting and filtering. See Filtering and Faceted Search.

    • sortableAttributes Required / array[string]

      List of attributes to sort on at search.

  • 401 object

    Unauthorized

    • message Required / string
    • errorCode Required / string
    • errorType Required / string
    • errorLink Required / string
  • 404

    Not Found

GET /indexes/{indexUid}/settings
$ curl \
 -X GET https://example.meilisearch.com:7700/indexes/{indexUid}/settings
Response example (200)
{
  "rankingRules": [
    "words",
    "typo",
    "proximity",
    "attribute",
    "sort",
    "exactness",
    "release_date:asc"
  ],
  "distinctAttribute": "ean13",
  "searchableAttributes": [
    "title",
    "description",
    "genre"
  ],
  "displayedAttributes": [
    "title",
    "description",
    "genre",
    "release_date"
  ],
  "stopWords": [
    "of",
    "the",
    "to"
  ],
  "synonyms": {
    "wolverine": [
      "xmen",
      "logan"
    ],
    "logan": [
      "wolverine",
      "xmen"
    ],
    "wow": [
      "world of warcraft"
    ]
  },
  "filterableAttributes": [
    "genres",
    "director"
  ],
  "sortableAttributes": [
    "price",
    "author",
    "title"
  ]
}
Response example (401)
{
  "message": "You must have an authorization token",
  "errorCode": "missing_authorization_header",
  "errorType": "authentication_error",
  "errorLink": "https://docs.meilisearch.com/errors#missing_authorization_header"
}

Update settings

Update the settings of an index.

Updates in the settings route are partial. This means that any parameters not provided in the body will be left unchanged.
Learn more about the settings in this guide.

If the provided index does not exist, it will be created.

Body
  • synonyms object

    List of associated words treated similarly. A word associated to an array of word as synonyms.

  • stopWords array[string]

    List of words ignored when present in search queries.

  • rankingRules array[string]

    List of ranking rules sorted by order of importance. The order is customizable.

    A list of ordered built-in ranking rules.

  • distinctAttribute string

    Search returns documents with distinct (different) values of the given field.

  • searchableAttributes array[string]

    Fields in which to search for matching query words sorted by order of importance.

  • displayedAttributes array[string]

    Fields displayed in the returned documents.

  • filterableAttributes array[string]

    Attributes to use for facetting and filtering. See Filtering and Faceted Search.

  • sortableAttributes array[string]

    List of attributes to sort on at search.

  • Additional properties are NOT allowed
Responses
  • 202 object

    Accepted

    • updateId Required / number

      This updateId allows you to track the current update.

    • Additional properties are NOT allowed
  • 401 object

    Unauthorized

    • message Required / string
    • errorCode Required / string
    • errorType Required / string
    • errorLink Required / string
  • 404

    Not Found

POST /indexes/{indexUid}/settings
$ curl \
 -X POST https://example.meilisearch.com:7700/indexes/{indexUid}/settings \
 -H "Content-Type: application/json" \
 -d '{"synonyms":{"wolverine":["xmen","logan"],"logan":["wolverine","xmen"],"wow":["world of warcraft"]},"stopWords":["of","the","to"],"rankingRules":["words","typo","proximity","attribute","sort","exactness","release_date:asc"],"distinctAttribute":"ean13","searchableAttributes":["title","description","genre"],"displayedAttributes":["title","description","genre","release_date"],"filterableAttributes":[],"sortableAttributes":null}'
Request payload example
{
  "synonyms": {
    "wolverine": [
      "xmen",
      "logan"
    ],
    "logan": [
      "wolverine",
      "xmen"
    ],
    "wow": [
      "world of warcraft"
    ]
  },
  "stopWords": [
    "of",
    "the",
    "to"
  ],
  "rankingRules": [
    "words",
    "typo",
    "proximity",
    "attribute",
    "sort",
    "exactness",
    "release_date:asc"
  ],
  "distinctAttribute": "ean13",
  "searchableAttributes": [
    "title",
    "description",
    "genre"
  ],
  "displayedAttributes": [
    "title",
    "description",
    "genre",
    "release_date"
  ],
  "filterableAttributes": [],
  "sortableAttributes": null
}
Response example (202)
{
  "updateId": 1
}
Response example (401)
{
  "message": "You must have an authorization token",
  "errorCode": "missing_authorization_header",
  "errorType": "authentication_error",
  "errorLink": "https://docs.meilisearch.com/errors#missing_authorization_header"
}

Reset settings

Reset the settings of an index.

All settings will be reset to their default value.

Responses
  • 202 object

    Accepted

    • updateId Required / number

      This updateId allows you to track the current update.

    • Additional properties are NOT allowed
  • 401 object

    Unauthorized

    • message Required / string
    • errorCode Required / string
    • errorType Required / string
    • errorLink Required / string
  • 404

    Not Found

DELETE /indexes/{indexUid}/settings
$ curl \
 -X DELETE https://example.meilisearch.com:7700/indexes/{indexUid}/settings
Response example (202)
{
  "updateId": 1
}
Response example (401)
{
  "message": "You must have an authorization token",
  "errorCode": "missing_authorization_header",
  "errorType": "authentication_error",
  "errorLink": "https://docs.meilisearch.com/errors#missing_authorization_header"
}

Get synonyms

Get the list of synonyms of an index.

Responses
  • 200 object

    Ok

  • 401 object

    Unauthorized

    • message Required / string
    • errorCode Required / string
    • errorType Required / string
    • errorLink Required / string
  • 404

    Not Found

GET /indexes/{indexUid}/settings/synonyms
$ curl \
 -X GET https://example.meilisearch.com:7700/indexes/{indexUid}/settings/synonyms
Response example (200)
{
  "wolverine": [
    "xmen",
    "logan"
  ],
  "logan": [
    "wolverine",
    "xmen"
  ],
  "wow": [
    "world of warcraft"
  ]
}
Response example (401)
{
  "message": "You must have an authorization token",
  "errorCode": "missing_authorization_header",
  "errorType": "authentication_error",
  "errorLink": "https://docs.meilisearch.com/errors#missing_authorization_header"
}

Update synonyms

Update the list of synonyms of an index. Synonyms are normalized.

If the provided index does not exist, it will be created.

Responses
  • 202 object

    Accepted

    • updateId Required / number

      This updateId allows you to track the current update.

    • Additional properties are NOT allowed
  • 401 object

    Unauthorized

    • message Required / string
    • errorCode Required / string
    • errorType Required / string
    • errorLink Required / string
  • 404

    Not Found

POST /indexes/{indexUid}/settings/synonyms
$ curl \
 -X POST https://example.meilisearch.com:7700/indexes/{indexUid}/settings/synonyms \
 -H "Content-Type: application/json"
Response example (202)
{
  "updateId": 1
}
Response example (401)
{
  "message": "You must have an authorization token",
  "errorCode": "missing_authorization_header",
  "errorType": "authentication_error",
  "errorLink": "https://docs.meilisearch.com/errors#missing_authorization_header"
}

Reset synonyms

Reset the list of synonyms of an index to its default value ({}).

Responses
  • 202 object

    Accepted

    • updateId Required / number

      This updateId allows you to track the current update.

    • Additional properties are NOT allowed
  • 401 object

    Unauthorized

    • message Required / string
    • errorCode Required / string
    • errorType Required / string
    • errorLink Required / string
  • 404

    Not Found

DELETE /indexes/{indexUid}/settings/synonyms
$ curl \
 -X DELETE https://example.meilisearch.com:7700/indexes/{indexUid}/settings/synonyms
Response example (202)
{
  "updateId": 1
}
Response example (401)
{
  "message": "You must have an authorization token",
  "errorCode": "missing_authorization_header",
  "errorType": "authentication_error",
  "errorLink": "https://docs.meilisearch.com/errors#missing_authorization_header"
}

Get sortable attributes

Get the list of sortableAttributes of an index.

Responses
  • 200 array[string]

    Ok

  • 401 object

    Unauthorized

    • message Required / string
    • errorCode Required / string
    • errorType Required / string
    • errorLink Required / string
  • 404

    Not Found

GET /indexes/{indexUid}/settings/sortable-attributes
$ curl \
 -X GET https://example.meilisearch.com:7700/indexes/{indexUid}/settings/sortable-attributes
Response example (200)
[
  "price",
  "author",
  "title"
]
Response example (401)
{
  "message": "You must have an authorization token",
  "errorCode": "missing_authorization_header",
  "errorType": "authentication_error",
  "errorLink": "https://docs.meilisearch.com/errors#missing_authorization_header"
}

Update sortable attributes

Update the list of sortableAttributes of an index.

Responses
  • 202 object

    Accepted

    • updateId Required / number

      This updateId allows you to track the current update.

    • Additional properties are NOT allowed
  • 401 object

    Unauthorized

    • message Required / string
    • errorCode Required / string
    • errorType Required / string
    • errorLink Required / string
  • 404

    Not Found

POST /indexes/{indexUid}/settings/sortable-attributes
$ curl \
 -X POST https://example.meilisearch.com:7700/indexes/{indexUid}/settings/sortable-attributes \
 -H "Content-Type: application/json"
Response example (202)
{
  "updateId": 1
}
Response example (401)
{
  "message": "You must have an authorization token",
  "errorCode": "missing_authorization_header",
  "errorType": "authentication_error",
  "errorLink": "https://docs.meilisearch.com/errors#missing_authorization_header"
}

Reset sortable attributes

Reset the list of sortableAttributes of an index to its default value ([]).

Responses
  • 202 object

    Accepted

    • updateId Required / number

      This updateId allows you to track the current update.

    • Additional properties are NOT allowed
  • 401 object

    Unauthorized

    • message Required / string
    • errorCode Required / string
    • errorType Required / string
    • errorLink Required / string
  • 404

    Not Found

DELETE /indexes/{indexUid}/settings/sortable-attributes
$ curl \
 -X DELETE https://example.meilisearch.com:7700/indexes/{indexUid}/settings/sortable-attributes
Response example (202)
{
  "updateId": 1
}
Response example (401)
{
  "message": "You must have an authorization token",
  "errorCode": "missing_authorization_header",
  "errorType": "authentication_error",
  "errorLink": "https://docs.meilisearch.com/errors#missing_authorization_header"
}

Get stop-words

Get the list of stop-words of an index.

Responses
  • 200 array[string]

    Ok

  • 401 object

    Unauthorized

    • message Required / string
    • errorCode Required / string
    • errorType Required / string
    • errorLink Required / string
  • 404

    Not Found

GET /indexes/{indexUid}/settings/stop-words
$ curl \
 -X GET https://example.meilisearch.com:7700/indexes/{indexUid}/settings/stop-words
Response example (200)
[
  "of",
  "the",
  "to"
]
Response example (401)
{
  "message": "You must have an authorization token",
  "errorCode": "missing_authorization_header",
  "errorType": "authentication_error",
  "errorLink": "https://docs.meilisearch.com/errors#missing_authorization_header"
}

Update stop-words

Update the list of stop-words of an index.

If a list of stop-words already exists it will be overwritten (replaced).

If the provided index does not exist, it will be created.

Responses
  • 202 object

    Accepted

    • updateId Required / number

      This updateId allows you to track the current update.

    • Additional properties are NOT allowed
  • 401 object

    Unauthorized

    • message Required / string
    • errorCode Required / string
    • errorType Required / string
    • errorLink Required / string
  • 404

    Not Found

POST /indexes/{indexUid}/settings/stop-words
$ curl \
 -X POST https://example.meilisearch.com:7700/indexes/{indexUid}/settings/stop-words \
 -H "Content-Type: application/json"
Response example (202)
{
  "updateId": 1
}
Response example (401)
{
  "message": "You must have an authorization token",
  "errorCode": "missing_authorization_header",
  "errorType": "authentication_error",
  "errorLink": "https://docs.meilisearch.com/errors#missing_authorization_header"
}

Reset stop-words

Reset the list of stop-words of an index to its default value ([]).

Responses
  • 202 object

    Accepted

    • updateId Required / number

      This updateId allows you to track the current update.

    • Additional properties are NOT allowed
  • 401 object

    Unauthorized

    • message Required / string
    • errorCode Required / string
    • errorType Required / string
    • errorLink Required / string
  • 404

    Not Found

DELETE /indexes/{indexUid}/settings/stop-words
$ curl \
 -X DELETE https://example.meilisearch.com:7700/indexes/{indexUid}/settings/stop-words
Response example (202)
{
  "updateId": 1
}
Response example (401)
{
  "message": "You must have an authorization token",
  "errorCode": "missing_authorization_header",
  "errorType": "authentication_error",
  "errorLink": "https://docs.meilisearch.com/errors#missing_authorization_header"
}

Get ranking rules

Get the ranking rules of an index.

Responses
  • 200 array[string]

    Ok

  • 401 object

    Unauthorized

    • message Required / string
    • errorCode Required / string
    • errorType Required / string
    • errorLink Required / string
  • 404

    Not Found

GET /indexes/{indexUid}/settings/ranking-rules
$ curl \
 -X GET https://example.meilisearch.com:7700/indexes/{indexUid}/settings/ranking-rules
Response example (200)
[
  "words",
  "typo",
  "proximity",
  "attribute",
  "sort",
  "exactness",
  "release_date:asc"
]
Response example (401)
{
  "message": "You must have an authorization token",
  "errorCode": "missing_authorization_header",
  "errorType": "authentication_error",
  "errorLink": "https://docs.meilisearch.com/errors#missing_authorization_header"
}

Update ranking rules

Update the ranking rules of an index.

To add your own ranking rule, you have to communicate either asc for ascending order or desc for descending order followed by the field name in brackets.

  • To apply an ascending custom ranking rule: attribute_name:asc
  • To apply a descending custom ranking rule: attribute_name:desc

If the provided index does not exist, it will be created.

Responses
  • 202 object

    Accepted

    • updateId Required / number

      This updateId allows you to track the current update.

    • Additional properties are NOT allowed
  • 401 object

    Unauthorized

    • message Required / string
    • errorCode Required / string
    • errorType Required / string
    • errorLink Required / string
  • 404

    Not Found

POST /indexes/{indexUid}/settings/ranking-rules
$ curl \
 -X POST https://example.meilisearch.com:7700/indexes/{indexUid}/settings/ranking-rules \
 -H "Content-Type: application/json"
Response example (202)
{
  "updateId": 1
}
Response example (401)
{
  "message": "You must have an authorization token",
  "errorCode": "missing_authorization_header",
  "errorType": "authentication_error",
  "errorLink": "https://docs.meilisearch.com/errors#missing_authorization_header"
}

Reset ranking rules

Reset the ranking rules of an index to its default value.

Default Value:

["words", "typo", "proximity", "attribute", "sort", "exactness"]

To remove all ranking rules, which is not recommended in any case, you would send an empty array to the add or replace ranking rules route.

Responses
  • 202 object

    Accepted

    • updateId Required / number

      This updateId allows you to track the current update.

    • Additional properties are NOT allowed
  • 401 object

    Unauthorized

    • message Required / string
    • errorCode Required / string
    • errorType Required / string
    • errorLink Required / string
  • 404

    Not Found

DELETE /indexes/{indexUid}/settings/ranking-rules
$ curl \
 -X DELETE https://example.meilisearch.com:7700/indexes/{indexUid}/settings/ranking-rules
Response example (202)
{
  "updateId": 1
}
Response example (401)
{
  "message": "You must have an authorization token",
  "errorCode": "missing_authorization_header",
  "errorType": "authentication_error",
  "errorLink": "https://docs.meilisearch.com/errors#missing_authorization_header"
}

Get Filterable Attributes

Get the filterable attributes of an index.

Responses
  • 200 array[string]

    Ok

  • 401 object

    Unauthorized

    • message Required / string
    • errorCode Required / string
    • errorType Required / string
    • errorLink Required / string
  • 404

    Not Found

GET /indexes/{indexUid}/settings/filterable-attributes
$ curl \
 -X GET https://example.meilisearch.com:7700/indexes/{indexUid}/settings/filterable-attributes
Response example (200)
[
  "genres",
  "director"
]
Response example (401)
{
  "message": "You must have an authorization token",
  "errorCode": "missing_authorization_header",
  "errorType": "authentication_error",
  "errorLink": "https://docs.meilisearch.com/errors#missing_authorization_header"
}

Update Filterable Attributes

Update the filterable attributes of an index.

If the provided index does not exist, it will be created.

Responses
  • 202 object

    Accepted

    • updateId Required / number

      This updateId allows you to track the current update.

    • Additional properties are NOT allowed
  • 401 object

    Unauthorized

    • message Required / string
    • errorCode Required / string
    • errorType Required / string
    • errorLink Required / string
  • 404

    Not Found

POST /indexes/{indexUid}/settings/filterable-attributes
$ curl \
 -X POST https://example.meilisearch.com:7700/indexes/{indexUid}/settings/filterable-attributes \
 -H "Content-Type: application/json"
Response example (202)
{
  "updateId": 1
}
Response example (401)
{
  "message": "You must have an authorization token",
  "errorCode": "missing_authorization_header",
  "errorType": "authentication_error",
  "errorLink": "https://docs.meilisearch.com/errors#missing_authorization_header"
}

Reset Filterable Attributes

Reset the filterable attributes of an index to its default value ([]).

Responses
  • 202 object

    Accepted

    • updateId Required / number

      This updateId allows you to track the current update.

    • Additional properties are NOT allowed
  • 401 object

    Unauthorized

    • message Required / string
    • errorCode Required / string
    • errorType Required / string
    • errorLink Required / string
  • 404

    Not Found

DELETE /indexes/{indexUid}/settings/filterable-attributes
$ curl \
 -X DELETE https://example.meilisearch.com:7700/indexes/{indexUid}/settings/filterable-attributes
Response example (202)
{
  "updateId": 1
}
Response example (401)
{
  "message": "You must have an authorization token",
  "errorCode": "missing_authorization_header",
  "errorType": "authentication_error",
  "errorLink": "https://docs.meilisearch.com/errors#missing_authorization_header"
}

Get distinct attribute

Get the distinct attribute field of an index.

Responses
  • 200 string

    Ok

  • 401 object

    Unauthorized

    • message Required / string
    • errorCode Required / string
    • errorType Required / string
    • errorLink Required / string
  • 404

    Not Found

GET /indexes/{indexUid}/settings/distinct-attribute
$ curl \
 -X GET https://example.meilisearch.com:7700/indexes/{indexUid}/settings/distinct-attribute
Response example (401)
{
  "message": "You must have an authorization token",
  "errorCode": "missing_authorization_header",
  "errorType": "authentication_error",
  "errorLink": "https://docs.meilisearch.com/errors#missing_authorization_header"
}

Update distinct attribute

Update the distinct attribute field of an index.

If the provided index does not exist, it will be created.

Responses
  • 202 object

    Accepted

    • updateId Required / number

      This updateId allows you to track the current update.

    • Additional properties are NOT allowed
  • 401 object

    Unauthorized

    • message Required / string
    • errorCode Required / string
    • errorType Required / string
    • errorLink Required / string
  • 404

    Not Found

POST /indexes/{indexUid}/settings/distinct-attribute
$ curl \
 -X POST https://example.meilisearch.com:7700/indexes/{indexUid}/settings/distinct-attribute \
 -H "Content-Type: application/json"
Response example (202)
{
  "updateId": 1
}
Response example (401)
{
  "message": "You must have an authorization token",
  "errorCode": "missing_authorization_header",
  "errorType": "authentication_error",
  "errorLink": "https://docs.meilisearch.com/errors#missing_authorization_header"
}

Reset distinct attribute

Reset the distinct attribute field of an index to its default value (null).

Responses
  • 202 object

    Accepted

    • updateId Required / number

      This updateId allows you to track the current update.

    • Additional properties are NOT allowed
  • 401 object

    Unauthorized

    • message Required / string
    • errorCode Required / string
    • errorType Required / string
    • errorLink Required / string
  • 404

    Not Found

DELETE /indexes/{indexUid}/settings/distinct-attribute
$ curl \
 -X DELETE https://example.meilisearch.com:7700/indexes/{indexUid}/settings/distinct-attribute
Response example (202)
{
  "updateId": 1
}
Response example (401)
{
  "message": "You must have an authorization token",
  "errorCode": "missing_authorization_header",
  "errorType": "authentication_error",
  "errorLink": "https://docs.meilisearch.com/errors#missing_authorization_header"
}

Get searchable attributes

Get the searchable attributes of an index.

Responses
  • 200 array[string]

    Ok

  • 401 object

    Unauthorized

    • message Required / string
    • errorCode Required / string
    • errorType Required / string
    • errorLink Required / string
  • 404

    Not Found

GET /indexes/{indexUid}/settings/searchable-attributes
$ curl \
 -X GET https://example.meilisearch.com:7700/indexes/{indexUid}/settings/searchable-attributes
Response example (200)
[
  "title",
  "description",
  "genre"
]
Response example (401)
{
  "message": "You must have an authorization token",
  "errorCode": "missing_authorization_header",
  "errorType": "authentication_error",
  "errorLink": "https://docs.meilisearch.com/errors#missing_authorization_header"
}

Update searchable attributes

Update the searchable attributes of an index.

If the provided index does not exist, it will be created.

Responses
  • 202 object

    Accepted

    • updateId Required / number

      This updateId allows you to track the current update.

    • Additional properties are NOT allowed
  • 401 object

    Unauthorized

    • message Required / string
    • errorCode Required / string
    • errorType Required / string
    • errorLink Required / string
  • 404

    Not Found

POST /indexes/{indexUid}/settings/searchable-attributes
$ curl \
 -X POST https://example.meilisearch.com:7700/indexes/{indexUid}/settings/searchable-attributes \
 -H "Content-Type: application/json"
Response example (202)
{
  "updateId": 1
}
Response example (401)
{
  "message": "You must have an authorization token",
  "errorCode": "missing_authorization_header",
  "errorType": "authentication_error",
  "errorLink": "https://docs.meilisearch.com/errors#missing_authorization_header"
}

Reset searchable attributes

Reset the searchable attributes of an index to its default value (['*']).

Responses
  • 202 object

    Accepted

    • updateId Required / number

      This updateId allows you to track the current update.

    • Additional properties are NOT allowed
  • 401 object

    Unauthorized

    • message Required / string
    • errorCode Required / string
    • errorType Required / string
    • errorLink Required / string
  • 404

    Not Found

DELETE /indexes/{indexUid}/settings/searchable-attributes
$ curl \
 -X DELETE https://example.meilisearch.com:7700/indexes/{indexUid}/settings/searchable-attributes
Response example (202)
{
  "updateId": 1
}
Response example (401)
{
  "message": "You must have an authorization token",
  "errorCode": "missing_authorization_header",
  "errorType": "authentication_error",
  "errorLink": "https://docs.meilisearch.com/errors#missing_authorization_header"
}

Get displayed attributes

Get the displayed attributes of an index.

Responses
  • 200 array[string]

    Ok

  • 401 object

    Unauthorized

    • message Required / string
    • errorCode Required / string
    • errorType Required / string
    • errorLink Required / string
  • 404

    Not Found

GET /indexes/{indexUid}/settings/displayed-attributes
$ curl \
 -X GET https://example.meilisearch.com:7700/indexes/{indexUid}/settings/displayed-attributes
Response example (200)
[
  "title",
  "description",
  "genre",
  "release_date"
]
Response example (401)
{
  "message": "You must have an authorization token",
  "errorCode": "missing_authorization_header",
  "errorType": "authentication_error",
  "errorLink": "https://docs.meilisearch.com/errors#missing_authorization_header"
}

Update displayed attributes

Update the displayed attributes of an index.

If the provided index does not exist, it will be created.

Responses
  • 202 object

    Accepted

    • updateId Required / number

      This updateId allows you to track the current update.

    • Additional properties are NOT allowed
  • 401 object

    Unauthorized

    • message Required / string
    • errorCode Required / string
    • errorType Required / string
    • errorLink Required / string
  • 404

    Not Found

POST /indexes/{indexUid}/settings/displayed-attributes
$ curl \
 -X POST https://example.meilisearch.com:7700/indexes/{indexUid}/settings/displayed-attributes \
 -H "Content-Type: application/json"
Response example (202)
{
  "updateId": 1
}
Response example (401)
{
  "message": "You must have an authorization token",
  "errorCode": "missing_authorization_header",
  "errorType": "authentication_error",
  "errorLink": "https://docs.meilisearch.com/errors#missing_authorization_header"
}

Reset displayed attributes

Reset the displayed attributes of an index to its default value (['*']).

Responses
  • 202 object

    Accepted

    • updateId Required / number

      This updateId allows you to track the current update.

    • Additional properties are NOT allowed
  • 401 object

    Unauthorized

    • message Required / string
    • errorCode Required / string
    • errorType Required / string
    • errorLink Required / string
  • 404

    Not Found

DELETE /indexes/{indexUid}/settings/displayed-attributes
$ curl \
 -X DELETE https://example.meilisearch.com:7700/indexes/{indexUid}/settings/displayed-attributes
Response example (202)
{
  "updateId": 1
}
Response example (401)
{
  "message": "You must have an authorization token",
  "errorCode": "missing_authorization_header",
  "errorType": "authentication_error",
  "errorLink": "https://docs.meilisearch.com/errors#missing_authorization_header"
}

Stats

Stats gives extended information and metrics about indexes and the MeiliSearch database.

Get stat of an index

Get stats of an index.

Responses
  • 200 object

    Ok

    • numberOfDocuments Required / integer

      Number of documents contained in the index.

    • isIndexing Required / boolean

      Whether or not the index is currently ingesting document

    • fieldDistribution Required / object

      How many documents contains a field

      • Additional properties: integer
    • Additional properties are NOT allowed
  • 401 object

    Unauthorized

    • message Required / string
    • errorCode Required / string
    • errorType Required / string
    • errorLink Required / string
  • 404

    Not Found

GET /indexes/{indexUid}/stats
$ curl \
 -X GET https://example.meilisearch.com:7700/indexes/{indexUid}/stats
Response example (401)
{
  "message": "You must have an authorization token",
  "errorCode": "missing_authorization_header",
  "errorType": "authentication_error",
  "errorLink": "https://docs.meilisearch.com/errors#missing_authorization_header"
}

Get stats of all indexes

Get stats of all indexes.

Responses
  • 200 object

    Ok

    • databaseSize Required / number
    • lastUpdate Required / string
    • indexes Required / object
      • indexUid object
        • numberOfDocuments Required / integer

          Number of documents contained in the index.

        • isIndexing Required / boolean

          Whether or not the index is currently ingesting document

        • fieldDistribution Required / object

          How many documents contains a field

          • Additional properties: integer
        • Additional properties are NOT allowed
    • Additional properties are NOT allowed