# Faceting

Child route of the settings route.

This route allows you to configure the faceting settings for an index.

Faceting settings can also be updated directly through the global settings route along with the other settings.

To learn more about filtering and faceting, refer to our dedicated guide.

WARNING

Updating the settings means overwriting the default settings of Meilisearch. You can reset to default values using the DELETE routes.

# Get faceting settings

GET
/indexes/{index_uid}/settings/faceting

Get the faceting settings of an index. The index uid is required.

# Example

curl \
  -X GET 'http://localhost:7700/indexes/books/settings/faceting'

# Response: 200 OK

{
  "maxValuesPerFacet": 100
}

# Returned fields

# maxValuesPerFacet

Maximum number of facet values returned for each facet.

# Update faceting settings

PATCH
/indexes/{index_uid}/settings/faceting

Partially update the faceting settings for an index. The index uid is required.

# Body

# maxValuesPerFacet

Type: integer
Default value: 100

Configure the maximum number of facet values returned for each facet. Values are sorted in ascending lexicographical order.

For example, suppose a query's search results contain a total of three values for a colors facet: blue, green, and red. If you set maxValuesPerFacet to 2, Meilisearch will only return blue and green in the response body's facetDistribution object.

NOTE

Setting maxValuesPerFacet to a high value might negatively impact performance.

# Example

curl \
  -X PATCH 'http://localhost:7700/indexes/books/settings/faceting' \
  -H 'Content-Type: application/json' \
  --data-binary '{
    "maxValuesPerFacet": 2
  }'

# Response: 202 Accepted

{
  "taskUid": 1,
  "indexUid": "books",
  "status": "enqueued",
  "type": "settingsUpdate",
  "enqueuedAt": "2022-04-14T20:56:44.991039Z"
}

You can use the returned taskUid to get more details on the status of the task.

# Reset faceting settings

Reset an index's faceting settings to their default value. The index uid is required.

# Example

curl \
  -X DELETE 'http://localhost:7700/indexes/books/settings/faceting'

# Response: 200 OK

{
  "taskUid": 1,
  "indexUid": "books",
  "status": "enqueued",
  "type": "settingsUpdate",
  "enqueuedAt": "2022-04-14T20:53:32.863107Z"
}

You can use the returned taskUid to get more details on the status of the task.