- Type:
list<string>
- Default:
[]
(no facets retrieved) - Scope:
search
facets
parameter lets you retrieve facet values and their match counts for each specified attribute.
For each specified attribute, such as color
, size
, or category
, the response includes:
- A list of facet values (for example:
blue
,red
,small
) - The number of matching records for each value
- An
exhaustive
object indicating whether the values or counts are complete
Usage
-
To retrieve counts for all available facets, use the wildcard:
["*"]
. -
Declare all attributes you want to facet on with
attributesForFaceting
. -
Facets don’t filter results.
Use the
filters
parameter to apply filtering. -
Facet values are sorted by frequency by default.
Use
sortFacetValuesBy
to change the sort order. - Each facet value is truncated to a maximum of 1,000 characters.
-
The number of facet values returned per facet is limited by
maxValuesPerFacet
(default: 100, max: 1,000). -
The response includes two optional properties:
facetsCount
:true
if facet counts are complete,false
if facet counts are approximate.facetValues
:true
if all facet values were retrieved,false
otherwise.
There’s no hard limit on the number of attributes you can include,
but adding too many can slow down
getSettings
operations
and degrade performance in the Algolia dashboard.Example
Current API clients
Current API clients
Legacy API clients
Legacy API clients
author
facet and one in the category
facet for “Classical”.
The facet count is exact.