Update faceting settings
Update the faceting settings of an index.
If the provided index does not exist, it will be created.
Headers
-
Payload content-type
Value is
application/json
.
Path parameters
-
Index Unique Identifier
Body Required
-
maxValuesPerFacet integer
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 have101
different colors if thecolor
` field is defined as a facet at search time.Default value is
100
. -
sortFacetValuesBy object
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.
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"
}