Update settings

PATCH /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 string Required

    Payload content-type

    Value is application/json.

Path parameters

  • indexUid string Required

    Index Unique Identifier

application/json

Body Required

  • 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 | null

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

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

  • displayedAttributes array[string]

    Fields displayed in the returned documents.

  • Attributes to use for faceting and filtering. See Filtering and Faceted Search.

  • sortableAttributes array[string]

    List of attributes to sort on at search.

  • Customize typo tolerance feature.

    Hide typoTolerance attributes Show typoTolerance attributes
    • 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 [] (empty).

    • disableOnWords array[string]

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

      Default value is [] (empty).

    • Hide minWordSizeForTypos attributes Show minWordSizeForTypos attributes
      • 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.

  • Customize pagination settings

    Hide pagination attribute Show pagination attribute
    • Define the maximum number of documents reachable for a search request. It means that with the default value of 1000, it is not possible to see the 1001st result for a search query.

      Default value is 1000.

  • faceting object

    Customize faceting settings

    Hide faceting attributes Show faceting attributes
    • Define maximum number of value returned for a facet for a search query. It means that with the default value of 100, it is not possible to have 101 different colors if the color` field is defined as a facet at search time.

      Default value is 100.

    • Defines how facet values are sorted. By default, all facets (*) are sorted by name, alphanumerically in ascending order (alpha). count sorts facet values by the number of documents containing a facet value in descending order.

Responses

  • 202 application/json

    Accepted

  • 401 application/json

    Unauthorized

    Hide response attributes Show response attributes object
  • 404

    Not Found

PATCH /indexes/{indexUid}/settings
curl \
 -X PATCH https://example.meilisearch.com:7700/indexes/movies/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}},"pagination":{"maxTotalHits":1000},"faceting":{"maxValuesPerFacet":100,"sortFacetValuesBy":{"*":"alpha"}}}'
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
    }
  },
  "pagination": {
    "maxTotalHits": 1000
  },
  "faceting": {
    "maxValuesPerFacet": 100,
    "sortFacetValuesBy": {
      "*": "alpha"
    }
  }
}
Response examples (202)
{
  "taskUid": 0,
  "indexUid": "movies",
  "status": "enqueued",
  "type": "settingsUpdate",
  "enqueuedAt": "2021-01-01T09:39:00.000000Z"
}
Response examples (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"
}