Skip to content

Autocomplete

GET /:handle/autocomplete

Combined autocomplete: searches document titles and optionally searches facet value names in a single request. When facets is provided, each field’s values are searched by name (substring match), not aggregated from matching documents.

ParameterTypeDefaultDescription
qstring""Autocomplete query prefix.
perPagenumber5Maximum number of document hits to return (1–20).
facetsstringComma-separated list of facet fields to search values by name.
maxFacetsPerFieldnumber4Maximum facet values returned per field (1–20).
{
"hits": [
{
"objectID": "515",
"_index": "museum_collections",
"_score": 8.2,
"_highlights": {},
"title": "Stonehenge"
}
],
"totalHits": 12,
"facets": {
"country": [
{ "value": "Scotland", "count": 18 }
]
}
}
FieldTypeDescription
hitsSearchHit[]Array of matching documents.
totalHitsnumberTotal number of matching documents.
facetsRecord<string, FacetValue[]>?Facet values matching the query by name (when facets param is provided).

Only hits, totalHits, and optionally facets are returned — no page, perPage, totalPages, or suggestions.

Terminal window
# Basic autocomplete
curl "https://search-api-elysia-production.up.railway.app/collections/autocomplete?q=ston"
# Limit to 3 results
curl "https://search-api-elysia-production.up.railway.app/collections/autocomplete?q=cas&perPage=3"
# With facet value search
curl "https://search-api-elysia-production.up.railway.app/collections/autocomplete?q=sc&facets=country,region"
# More facet values per field
curl "https://search-api-elysia-production.up.railway.app/collections/autocomplete?q=sc&facets=country&maxFacetsPerField=8"
StatusCondition
401Missing or invalid bearer token
404Index handle not found