Facets
Try it
Section titled “Try it”GET /:handle/facets/:fieldSearch within a facet field’s values. Useful for building typeahead facet filters where users search for specific values within a facet.
Path parameters
Section titled “Path parameters”| Parameter | Type | Description |
|---|---|---|
handle | string | Index handle as configured in config.yaml |
field | string | Facet field name to search within (supports aliases) |
Query parameters
Section titled “Query parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
q | string | "" | Text to filter facet values (case-insensitive substring). |
maxValues | number | 20 | Maximum number of facet values to return (1–100). |
filters | json | — | JSON object to narrow the facet context. Values can be a string or array of strings. |
The :field parameter and filters keys support field aliases when configured.
Response
Section titled “Response”{ "field": "country", "values": [ { "value": "Scotland", "count": 18 }, { "value": "Scandinavia", "count": 5 } ]}| Field | Type | Description |
|---|---|---|
field | string | The facet field name. |
values | FacetValue[] | Matching values with counts. |
Examples
Section titled “Examples”# List all country valuescurl "https://search-api-elysia-production.up.railway.app/collections/facets/country"
# Search for countries matching "sc"curl "https://search-api-elysia-production.up.railway.app/collections/facets/country?q=sc"
# Top 5 regionscurl "https://search-api-elysia-production.up.railway.app/collections/facets/region?maxValues=5"
# Regions within Scotland onlycurl "https://search-api-elysia-production.up.railway.app/collections/facets/region?filters=%7B%22country%22%3A%22Scotland%22%7D"The filters param in the last example decoded: {"country":"Scotland"}
Disjunctive facets
Section titled “Disjunctive facets”For OR-mode facet filtering (where selecting a value doesn’t reduce its own counts), exclude the current field from filters. See Disjunctive Facets for the full pattern.
Nested fields
Section titled “Nested fields”Fields inside Elasticsearch nested objects work automatically when nestedPath is configured. The API wraps filters and aggregations in the required nested queries transparently.
Error responses
Section titled “Error responses”| Status | Condition |
|---|---|
400 | Invalid JSON in filters |
401 | Missing or invalid bearer token |
404 | Index handle not found |