Back to Top

Search documents, configure and manage the Meilisearch engine.

This is the documentation for version 0.27.0 of the API. Last update on May 16, 2022.

This API is provided under license MIT.

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

Api key (http)

An API key is a token that you provide when making API calls. Include the token in a header parameter called Authorization.

Example: Authorization: Bearer 8fece4405662dd830e4cb265e7e047aab2e79672a760a12712d2a263c9003509


Create a Dump

POST /dumps

Triggers a dump creation process. Once the process is complete, a dump is created in the dumps directory. If the dumps directory does not exist yet, it will be created.

Responses
  • 202 object

    Accepted

  • 401 object

    Unauthorized

    • message Required / string
    • code Required / string
    • type Required / string
POST /dumps
curl \
 -X POST https://example.meilisearch.com:7700/dumps \
 -H "Authorization: Bearer $ACCESS_TOKEN"
Response example (202)
{
  "uid": "20210719-114144097",
  "status": "in_progress",
  "startedAt": "2021-07-19T14:31:16.920473Z"
}
Response example (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"
}

Get dump status

GET /dumps/{dumpUid}/status

Get the status of a dump creation process using the uid returned after calling the dump creation route.

The returned status could be:

  • in_progress: Dump creation is in progress.
  • failed: An error occured during dump process, and the task was aborted.
  • done: Dump creation is finished and was successful.
Responses
  • 200 object

    Ok

  • 401 object

    Unauthorized

    • message Required / string
    • code Required / string
    • type Required / string
  • 404 object

    Not Found

    • message Required / string
    • code Required / string
    • type Required / string
GET /dumps/{dumpUid}/status
curl \
 -X GET https://example.meilisearch.com:7700/dumps/{dumpUid}/status \
 -H "Authorization: Bearer $ACCESS_TOKEN"
Response example (200)
{
  "uid": "20210719-114144097",
  "status": "done",
  "startedAt": "2021-07-19T14:31:16.920473Z",
  "finishedAt": "2021-07-19T14:32:16.920473Z"
}
Response example (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"
}
Response example (404)
{
  "message": "Dump `20201001-110357260` not found",
  "code": "dump_not_found",
  "type": "invalid_request",
  "link": "https://docs.meilisearch.com/errors#dump_not_found"
}

Get health

GET /health

Get health of the Meilisearch instance.

Responses
  • 200 object

    Ok

    • status Required / string

      Values are available.

GET /health
curl \
 -X GET https://example.meilisearch.com:7700/health
Response example (200)
{
  "status": "available"
}

List Indexes

GET /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 string | null

      Custom primaryKey for documents

    • createdAt Required / string

      An RFC 3339 format for date/time/duration.

    • updatedAt Required / string

      An RFC 3339 format for date/time/duration.

  • 401 object

    Unauthorized

    • message Required / string
    • code Required / string
    • type Required / string
GET /indexes
curl \
 -X GET https://example.meilisearch.com:7700/indexes \
 -H "Authorization: Bearer $ACCESS_TOKEN"
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": "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"
}

Create Index

POST /indexes

Create an index.

Headers
  • Content-Type Required / string

    Payload content-type

    Values are application/json.

Body Required
Responses
  • 201 object

    Created

  • 400 object

    Bad Request

    • message Required / string
    • code Required / string
    • type Required / string
  • 401 object

    Unauthorized

    • message Required / string
    • code Required / string
    • type Required / string
POST /indexes
curl \
 -X POST https://example.meilisearch.com:7700/indexes \
 -H "Authorization: Bearer $ACCESS_TOKEN" \
 -H "Content-Type: application/json" \
 -d '{"uid":"movies","primaryKey":"movie_id"}'
Request example
# Headers
Content-Type: application/json

# Payload
{
  "uid": "movies",
  "primaryKey": "movie_id"
}
Response example (201)
{
  "uid": "movies",
  "name": "movies",
  "primaryKey": "movie_id",
  "createdAt": "2019-11-20T09:40:33.711324Z",
  "updatedAt": "2019-11-20T09:40:33.711324Z"
}
Response examples (400)
{
  "message": "Index `:indexUid` already exists.",
  "code": "index_already_exists",
  "type": "invalid_request",
  "link": "https://docs.meilisearch.com/errors#index_already_exists"
}
{
  "message": "`:indexUid` is not a valid index uid. Index uid can be an integer or a string containing only alphanumeric characters, hyphens (-) and underscores (_).",
  "code": "invalid_index_uid",
  "type": "invalid_request",
  "link": "https://docs.meilisearch.com/errors#invalid_index_uid"
}
Response example (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"
}

Get Index

GET /indexes/{indexUid}

Get information about an index.

Responses
GET /indexes/{indexUid}
curl \
 -X GET https://example.meilisearch.com:7700/indexes/{indexUid} \
 -H "Authorization: Bearer $ACCESS_TOKEN"
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": "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"
}

Update Index

PUT /indexes/{indexUid}

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

Headers
  • Content-Type Required / string

    Payload content-type

    Values are application/json.

Responses
  • 200 object

    Ok

  • 400 object

    Bad Request

    • message Required / string
    • code Required / string
    • type Required / string
  • 401 object

    Unauthorized

    • message Required / string
    • code Required / string
    • type Required / string
  • 404

    Not Found

PUT /indexes/{indexUid}
curl \
 -X PUT https://example.meilisearch.com:7700/indexes/{indexUid} \
 -H "Authorization: Bearer $ACCESS_TOKEN" \
 -H "Content-Type: application/json" \
 -d '{"primaryKey":"string"}'
Request example
# Headers
Content-Type: application/json

# Payload
{
  "primaryKey": "string"
}
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 (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 example (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"
}

Delete Index

DELETE /indexes/{indexUid}

Delete an index.

Responses
  • 204

    No Content

  • 401 object

    Unauthorized

    • message Required / string
    • code Required / string
    • type Required / string
  • 404

    Not Found

DELETE /indexes/{indexUid}
curl \
 -X DELETE https://example.meilisearch.com:7700/indexes/{indexUid} \
 -H "Authorization: Bearer $ACCESS_TOKEN"
Response example (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"
}

Get Documents

GET /indexes/{indexUid}/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.

  • 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
GET /indexes/{indexUid}/documents
curl \
 -X GET https://example.meilisearch.com:7700/indexes/{indexUid}/documents \
 -H "Authorization: Bearer $ACCESS_TOKEN"
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": "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"
}

Add or update documents

PUT /indexes/{indexUid}/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.

Use the reserved _geo object to add geo coordinates to a document. _geo is an object made of lat and lng field.

Headers
  • Content-Type Required / string

    The content-type associated with the format to be indexed

    Values are application/json, text/csv, or application/x-ndjson.

Responses
PUT /indexes/{indexUid}/documents
curl \
 -X PUT https://example.meilisearch.com:7700/indexes/{indexUid}/documents \
 -H "Authorization: Bearer $ACCESS_TOKEN" \
 -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 example
# Headers
Content-Type: application/json

# Payload
[
  {
    "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)
{
  "uid": 0,
  "indexUid": "movies",
  "status": "enqueued",
  "enqueuedAt": "2021-07-19T14:31:16.920473Z"
}
Response example (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"
}
Response example (413)
{
  "message": "The provided payload reached the size limit.",
  "code": "payload_too_large",
  "type": "invalid_request",
  "link": "https://docs.meilisearch.com/errors#payload_too_large"
}

Add or replace documents

POST /indexes/{indexUid}/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.

Use the reserved _geo object to add geo coordinates to a document. _geo is an object made of lat and lng field.

Headers
  • Content-Type Required / string

    The content-type associated with the format to be indexed

    Values are application/json, text/csv, or application/x-ndjson.

Responses
POST /indexes/{indexUid}/documents
curl \
 -X POST https://example.meilisearch.com:7700/indexes/{indexUid}/documents \
 -H "Authorization: Bearer $ACCESS_TOKEN" \
 -H "Content-Type: application/json"
Response example (202)
{
  "uid": 0,
  "indexUid": "movies",
  "status": "enqueued",
  "enqueuedAt": "2021-07-19T14:31:16.920473Z"
}
Response example (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"
}
Response example (413)
{
  "message": "The provided payload reached the size limit.",
  "code": "payload_too_large",
  "type": "invalid_request",
  "link": "https://docs.meilisearch.com/errors#payload_too_large"
}

Delete all documents

DELETE /indexes/{indexUid}/documents

Delete all documents in the specified index.

Responses
DELETE /indexes/{indexUid}/documents
curl \
 -X DELETE https://example.meilisearch.com:7700/indexes/{indexUid}/documents \
 -H "Authorization: Bearer $ACCESS_TOKEN"
Response example (202)
{
  "uid": 0,
  "indexUid": "movies",
  "status": "enqueued",
  "enqueuedAt": "2021-07-19T14:31:16.920473Z"
}
Response example (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"
}

Delete documents

POST /indexes/{indexUid}/documents/delete-batch

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

Headers
  • Content-Type Required / string

    Payload content-type

    Values are application/json.

Responses
POST /indexes/{indexUid}/documents/delete-batch
curl \
 -X POST https://example.meilisearch.com:7700/indexes/{indexUid}/documents/delete-batch \
 -H "Authorization: Bearer $ACCESS_TOKEN" \
 -H "Content-Type: application/json" \
 -d '[1,2,3,"a string id"]'
Request example
# Headers
Content-Type: application/json

# Payload
[
  1,
  2,
  3,
  "a string id"
]
Response example (202)
{
  "uid": 0,
  "indexUid": "movies",
  "status": "enqueued",
  "enqueuedAt": "2021-07-19T14:31:16.920473Z"
}
Response example (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"
}

Get one document

GET /indexes/{indexUid}/documents/{documentId}

Get one document using its unique id.

Responses
GET /indexes/{indexUid}/documents/{documentId}
curl \
 -X GET https://example.meilisearch.com:7700/indexes/{indexUid}/documents/{documentId} \
 -H "Authorization: Bearer $ACCESS_TOKEN"
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": "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"
}

Delete one document

DELETE /indexes/{indexUid}/documents/{documentId}

Delete one document based on its unique id.

Responses
DELETE /indexes/{indexUid}/documents/{documentId}
curl \
 -X DELETE https://example.meilisearch.com:7700/indexes/{indexUid}/documents/{documentId} \
 -H "Authorization: Bearer $ACCESS_TOKEN"
Response example (202)
{
  "uid": 0,
  "indexUid": "movies",
  "status": "enqueued",
  "enqueuedAt": "2021-07-19T14:31:16.920473Z"
}
Response example (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"
}

Search

GET /indexes/{indexUid}/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 "".

  • 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 *.

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

  • Specify the tag to put before the highlighted query terms.

    Default value is <em>.

  • Specify the tag to put after the highlighted query terms.

    Default value is </em>.

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

  • cropMarker string

    Sets the crop marker to apply before and/or after cropped part selected within an attribute defined in attributesToCrop parameter.

    Default value is .

  • cropLength integer

    Sets the total number of words to keep around the matched part of an attribute specified in the attributesToCrop parameter.

    Default value is 10.

  • 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

  • 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"]

    _geoRadius({lat}, {lng}, {distance_in_meters}) built-in filter rule can be used to filter documents within a geo circle.

    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.

    _geoPoint({lat}, {long}) built-in sort rule can be used to sort documents around a geo point.

  • 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
GET /indexes/{indexUid}/search
curl \
 -X GET https://example.meilisearch.com:7700/indexes/{indexUid}/search \
 -H "Authorization: Bearer $ACCESS_TOKEN"
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": "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"
}

Get settings

GET /indexes/{indexUid}/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 | null

      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.

    • typoTolerance Required / object

      Customize typo tolerance feature.

      • enabled boolean

        Enable the typo tolerance feature.

        Default value is true.

      • disableOnAttributes array[string]

        Disable the typo tolerance feature on the specified attributes.

        Default value is [].

      • disableOnWords array[string]

        Disable the typo tolerance feature for a set of query terms given for a search query.

        Default value is [].

        • oneTypo integer

          Customize the minimum size for a word to tolerate 1 typo.

          Default value is 5.

        • twoTypos integer

          Customize the minimum size for a word to tolerate 2 typos.

          Default value is 9.

  • 401 object

    Unauthorized

    • message Required / string
    • code Required / string
    • type Required / string
  • 404

    Not Found

GET /indexes/{indexUid}/settings
curl \
 -X GET https://example.meilisearch.com:7700/indexes/{indexUid}/settings \
 -H "Authorization: Bearer $ACCESS_TOKEN"
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"
  ],
  "typoTolerance": {
    "enabled": true,
    "disableOnAttributes": [
      "author",
      "price"
    ],
    "disableOnWords": [
      "Tolkien"
    ],
    "minWordSizeForTypos": {
      "oneTypo": 4,
      "twoTypos": 8
    }
  }
}
Response example (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"
}

Update settings

POST /indexes/{indexUid}/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.

Headers
  • Content-Type Required / string

    Payload content-type

    Values are application/json.

Body Required
Responses
POST /indexes/{indexUid}/settings
curl \
 -X POST https://example.meilisearch.com:7700/indexes/{indexUid}/settings \
 -H "Authorization: Bearer $ACCESS_TOKEN" \
 -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,"typoTolerance":{"enabled":false,"disableOnAttributes":["title","author"],"disableOnWords":["Tolkien"],"minWordSizeForTypos":{"oneTypo":4,"twoTypos":8}}}'
Request example
# Headers
Content-Type: application/json

# Payload
{
  "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,
  "typoTolerance": {
    "enabled": false,
    "disableOnAttributes": [
      "title",
      "author"
    ],
    "disableOnWords": [
      "Tolkien"
    ],
    "minWordSizeForTypos": {
      "oneTypo": 4,
      "twoTypos": 8
    }
  }
}
Response example (202)
{
  "uid": 0,
  "indexUid": "movies",
  "status": "enqueued",
  "enqueuedAt": "2021-07-19T14:31:16.920473Z"
}
Response example (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"
}

Reset settings

DELETE /indexes/{indexUid}/settings

Reset the settings of an index.

All settings will be reset to their default value.

Responses
DELETE /indexes/{indexUid}/settings
curl \
 -X DELETE https://example.meilisearch.com:7700/indexes/{indexUid}/settings \
 -H "Authorization: Bearer $ACCESS_TOKEN"
Response example (202)
{
  "uid": 0,
  "indexUid": "movies",
  "status": "enqueued",
  "enqueuedAt": "2021-07-19T14:31:16.920473Z"
}
Response example (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"
}

Get synonyms

GET /indexes/{indexUid}/settings/synonyms

Get the list of synonyms of an index.

Responses
  • 200 object

    Ok

  • 401 object

    Unauthorized

    • message Required / string
    • code Required / string
    • type Required / string
  • 404

    Not Found

GET /indexes/{indexUid}/settings/synonyms
curl \
 -X GET https://example.meilisearch.com:7700/indexes/{indexUid}/settings/synonyms \
 -H "Authorization: Bearer $ACCESS_TOKEN"
Response example (200)
{
  "wolverine": [
    "xmen",
    "logan"
  ],
  "logan": [
    "wolverine",
    "xmen"
  ],
  "wow": [
    "world of warcraft"
  ]
}
Response example (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"
}

Update synonyms

POST /indexes/{indexUid}/settings/synonyms

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

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

Headers
  • Content-Type Required / string

    Payload content-type

    Values are application/json.

Responses
POST /indexes/{indexUid}/settings/synonyms
curl \
 -X POST https://example.meilisearch.com:7700/indexes/{indexUid}/settings/synonyms \
 -H "Authorization: Bearer $ACCESS_TOKEN" \
 -H "Content-Type: application/json" \
 -d '{"wolverine":["xmen","logan"],"logan":["wolverine","xmen"],"wow":["world of warcraft"]}'
Request example
# Headers
Content-Type: application/json

# Payload
{
  "wolverine": [
    "xmen",
    "logan"
  ],
  "logan": [
    "wolverine",
    "xmen"
  ],
  "wow": [
    "world of warcraft"
  ]
}
Response example (202)
{
  "uid": 0,
  "indexUid": "movies",
  "status": "enqueued",
  "enqueuedAt": "2021-07-19T14:31:16.920473Z"
}
Response example (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"
}

Reset synonyms

DELETE /indexes/{indexUid}/settings/synonyms

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

Responses
DELETE /indexes/{indexUid}/settings/synonyms
curl \
 -X DELETE https://example.meilisearch.com:7700/indexes/{indexUid}/settings/synonyms \
 -H "Authorization: Bearer $ACCESS_TOKEN"
Response example (202)
{
  "uid": 0,
  "indexUid": "movies",
  "status": "enqueued",
  "enqueuedAt": "2021-07-19T14:31:16.920473Z"
}
Response example (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"
}

Get sortable attributes

GET /indexes/{indexUid}/settings/sortable-attributes

Get the list of sortableAttributes of an index.

Responses
  • 200 array[string]

    Ok

  • 401 object

    Unauthorized

    • message Required / string
    • code Required / string
    • type Required / string
  • 404

    Not Found

GET /indexes/{indexUid}/settings/sortable-attributes
curl \
 -X GET https://example.meilisearch.com:7700/indexes/{indexUid}/settings/sortable-attributes \
 -H "Authorization: Bearer $ACCESS_TOKEN"
Response example (200)
[
  "price",
  "author",
  "title"
]
Response example (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"
}

Update sortable attributes

POST /indexes/{indexUid}/settings/sortable-attributes

Update the list of sortableAttributes of an index.

In order to enable sorting capabilities on geographic data, the _geo field must be added as a sortableAttribute.

Headers
  • Content-Type Required / string

    Payload content-type

    Values are application/json.

Responses
POST /indexes/{indexUid}/settings/sortable-attributes
curl \
 -X POST https://example.meilisearch.com:7700/indexes/{indexUid}/settings/sortable-attributes \
 -H "Authorization: Bearer $ACCESS_TOKEN" \
 -H "Content-Type: application/json" \
 -d '["price","author","title"]'
Request example
# Headers
Content-Type: application/json

# Payload
[
  "price",
  "author",
  "title"
]
Response example (202)
{
  "uid": 0,
  "indexUid": "movies",
  "status": "enqueued",
  "enqueuedAt": "2021-07-19T14:31:16.920473Z"
}
Response example (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"
}

Reset sortable attributes

DELETE /indexes/{indexUid}/settings/sortable-attributes

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

Responses
DELETE /indexes/{indexUid}/settings/sortable-attributes
curl \
 -X DELETE https://example.meilisearch.com:7700/indexes/{indexUid}/settings/sortable-attributes \
 -H "Authorization: Bearer $ACCESS_TOKEN"
Response example (202)
{
  "uid": 0,
  "indexUid": "movies",
  "status": "enqueued",
  "enqueuedAt": "2021-07-19T14:31:16.920473Z"
}
Response example (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"
}

Get stop-words

GET /indexes/{indexUid}/settings/stop-words

Get the list of stop-words of an index.

Responses
  • 200 array[string]

    Ok

  • 401 object

    Unauthorized

    • message Required / string
    • code Required / string
    • type Required / string
  • 404

    Not Found

GET /indexes/{indexUid}/settings/stop-words
curl \
 -X GET https://example.meilisearch.com:7700/indexes/{indexUid}/settings/stop-words \
 -H "Authorization: Bearer $ACCESS_TOKEN"
Response example (200)
[
  "of",
  "the",
  "to"
]
Response example (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"
}

Update stop-words

POST /indexes/{indexUid}/settings/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.

Headers
  • Content-Type Required / string

    Payload content-type

    Values are application/json.

Responses
POST /indexes/{indexUid}/settings/stop-words
curl \
 -X POST https://example.meilisearch.com:7700/indexes/{indexUid}/settings/stop-words \
 -H "Authorization: Bearer $ACCESS_TOKEN" \
 -H "Content-Type: application/json" \
 -d '["of","the","to"]'
Request example
# Headers
Content-Type: application/json

# Payload
[
  "of",
  "the",
  "to"
]
Response example (202)
{
  "uid": 0,
  "indexUid": "movies",
  "status": "enqueued",
  "enqueuedAt": "2021-07-19T14:31:16.920473Z"
}
Response example (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"
}

Reset stop-words

DELETE /indexes/{indexUid}/settings/stop-words

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

Responses
DELETE /indexes/{indexUid}/settings/stop-words
curl \
 -X DELETE https://example.meilisearch.com:7700/indexes/{indexUid}/settings/stop-words \
 -H "Authorization: Bearer $ACCESS_TOKEN"
Response example (202)
{
  "uid": 0,
  "indexUid": "movies",
  "status": "enqueued",
  "enqueuedAt": "2021-07-19T14:31:16.920473Z"
}
Response example (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"
}

Get ranking rules

GET /indexes/{indexUid}/settings/ranking-rules

Get the ranking rules of an index.

Responses
  • 200 array[string]

    Ok

  • 401 object

    Unauthorized

    • message Required / string
    • code Required / string
    • type Required / string
  • 404

    Not Found

GET /indexes/{indexUid}/settings/ranking-rules
curl \
 -X GET https://example.meilisearch.com:7700/indexes/{indexUid}/settings/ranking-rules \
 -H "Authorization: Bearer $ACCESS_TOKEN"
Response example (200)
[
  "words",
  "typo",
  "proximity",
  "attribute",
  "sort",
  "exactness",
  "release_date:asc"
]
Response example (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"
}

Update ranking rules

POST /indexes/{indexUid}/settings/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.

Headers
  • Content-Type Required / string

    Payload content-type

    Values are application/json.

Responses
POST /indexes/{indexUid}/settings/ranking-rules
curl \
 -X POST https://example.meilisearch.com:7700/indexes/{indexUid}/settings/ranking-rules \
 -H "Authorization: Bearer $ACCESS_TOKEN" \
 -H "Content-Type: application/json" \
 -d '["words","typo","proximity","attribute","sort","exactness","release_date:asc"]'
Request example
# Headers
Content-Type: application/json

# Payload
[
  "words",
  "typo",
  "proximity",
  "attribute",
  "sort",
  "exactness",
  "release_date:asc"
]
Response example (202)
{
  "uid": 0,
  "indexUid": "movies",
  "status": "enqueued",
  "enqueuedAt": "2021-07-19T14:31:16.920473Z"
}
Response example (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"
}

Reset ranking rules

DELETE /indexes/{indexUid}/settings/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
DELETE /indexes/{indexUid}/settings/ranking-rules
curl \
 -X DELETE https://example.meilisearch.com:7700/indexes/{indexUid}/settings/ranking-rules \
 -H "Authorization: Bearer $ACCESS_TOKEN"
Response example (202)
{
  "uid": 0,
  "indexUid": "movies",
  "status": "enqueued",
  "enqueuedAt": "2021-07-19T14:31:16.920473Z"
}
Response example (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"
}

Get typo tolerance configuration

GET /indexes/{indexUid}/settings/typo-tolerance

Get the typo tolerance configuration of an index.

Responses
  • 200 object

    Ok

    • enabled boolean

      Enable the typo tolerance feature.

      Default value is true.

    • disableOnAttributes array[string]

      Disable the typo tolerance feature on the specified attributes.

      Default value is [].

    • disableOnWords array[string]

      Disable the typo tolerance feature for a set of query terms given for a search query.

      Default value is [].

      • oneTypo integer

        Customize the minimum size for a word to tolerate 1 typo.

        Default value is 5.

      • twoTypos integer

        Customize the minimum size for a word to tolerate 2 typos.

        Default value is 9.

  • 401 object

    Unauthorized

    • message Required / string
    • code Required / string
    • type Required / string
  • 404

    Not Found

GET /indexes/{indexUid}/settings/typo-tolerance
curl \
 -X GET https://example.meilisearch.com:7700/indexes/{indexUid}/settings/typo-tolerance \
 -H "Authorization: Bearer $ACCESS_TOKEN"
Response example (200)
{
  "enabled": true,
  "disableOnAttributes": [],
  "disableOnWords": [],
  "minWordSizeForTypos": {
    "oneTypo": 5,
    "twoTypos": 9
  }
}
Response example (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"
}

Update typo tolerance settings

POST /indexes/{indexUid}/settings/typo-tolerance

Update the typo tolerance configuration of an index.

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

Headers
  • Content-Type Required / string

    Payload content-type

    Values are application/json.

Body Required
  • enabled boolean

    Enable the typo tolerance feature.

    Default value is true.

  • disableOnAttributes array[string]

    Disable the typo tolerance feature on the specified attributes.

    Default value is [].

  • disableOnWords array[string]

    Disable the typo tolerance feature for a set of query terms given for a search query.

    Default value is [].

    • oneTypo integer

      Customize the minimum size for a word to tolerate 1 typo.

      Default value is 5.

    • twoTypos integer

      Customize the minimum size for a word to tolerate 2 typos.

      Default value is 9.

Responses
POST /indexes/{indexUid}/settings/typo-tolerance
curl \
 -X POST https://example.meilisearch.com:7700/indexes/{indexUid}/settings/typo-tolerance \
 -H "Authorization: Bearer $ACCESS_TOKEN" \
 -H "Content-Type: application/json" \
 -d '{"enabled":true,"disableOnAttributes":[],"disableOnWords":[],"minWordSizeForTypos":{"oneTypo":5,"twoTypos":9}}'
Request example
# Headers
Content-Type: application/json

# Payload
{
  "enabled": true,
  "disableOnAttributes": [],
  "disableOnWords": [],
  "minWordSizeForTypos": {
    "oneTypo": 5,
    "twoTypos": 9
  }
}
Response example (202)
{
  "uid": 0,
  "indexUid": "movies",
  "status": "enqueued",
  "enqueuedAt": "2021-07-19T14:31:16.920473Z"
}
Response example (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"
}

Reset typo tolerance settings to the default configuration

DELETE /indexes/{indexUid}/settings/typo-tolerance

Reset the typo tolerance settings of an index to its default configuration.

Responses
DELETE /indexes/{indexUid}/settings/typo-tolerance
curl \
 -X DELETE https://example.meilisearch.com:7700/indexes/{indexUid}/settings/typo-tolerance \
 -H "Authorization: Bearer $ACCESS_TOKEN"
Response example (202)
{
  "uid": 0,
  "indexUid": "movies",
  "status": "enqueued",
  "enqueuedAt": "2021-07-19T14:31:16.920473Z"
}
Response example (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"
}

Get Filterable Attributes

GET /indexes/{indexUid}/settings/filterable-attributes

Get the filterable attributes of an index.

Responses
  • 200 array[string]

    Ok

  • 401 object

    Unauthorized

    • message Required / string
    • code Required / string
    • type Required / string
  • 404

    Not Found

GET /indexes/{indexUid}/settings/filterable-attributes