Update faceting settings

PATCH /indexes/{indexUid}/settings/faceting

Update the faceting settings of an index.


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

  • 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
  • Not Found

PATCH /indexes/{indexUid}/settings/faceting
curl \
 -X PATCH https://example.meilisearch.com:7700/indexes/movies/settings/faceting \
 -H "Authorization: Bearer $ACCESS_TOKEN" \
 -H "Content-Type: application/json" \
 -d '{"maxValuesPerFacet":100,"sortFacetValuesBy":{"*":"alpha","genres":"count"}}'
Request example
# Headers
Content-Type: application/json

# Payload
{
  "maxValuesPerFacet": 100,
  "sortFacetValuesBy": {
    "*": "alpha",
    "genres": "count"
  }
}
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"
}