Skip to content

Search

GET /:handle/search

Full-text search with pagination, facets, filters, sorting, highlighting, histograms, and geo clustering.

ParameterTypeDefaultDescription
qstring""Search query text. Empty string returns all documents.
pagenumber1Page number (1-based).
perPagenumber20 / configResults per page (1–100).
sortjsonSort order. JSON object mapping field names to "asc" or "desc".
facetsstringconfig defaultComma-separated list of fields to aggregate as facets.
filtersjsonField filters. See Filters.
highlightstringconfig default"true" to highlight all fields, or a comma-separated list of field names to highlight selectively (e.g. "title,description").
fieldsstringall fieldsComma-separated list of fields to return.
suggeststring"true" to enable phrase suggestions (requires suggestField in config). ES/OS only
boostsjsonconfig defaultField boost weights. JSON object mapping field names to numbers. ES/OS only
histogramjsonHistogram intervals. See Histograms. ES/OS only
geoGridjsonGeo tile grid. See Geo Map. ES/OS only

All field-name parameters (sort, facets, filters, boosts, fields, highlight, histogram, geoGrid.field) support field aliases when configured.

Field weights are normally set in config via fields with weight — these are applied automatically on every search. The boosts query param exists as an override: if a request passes boosts, the config weights are ignored for that request.

When no boosts are configured at all, the API falls back to fields marked searchable: true, then to all fields (*).

See Configuration for setting up field weights.

When suggest=true is set and a suggestField is configured for the index, the API returns phrase-level corrections in the suggestions array. The suggest field should have a shingle analyzer configured in your Elasticsearch mapping for best results. Suggestions are only generated when the search query is non-empty.

{
"hits": [
{
"objectID": "498",
"_index": "museum_collections",
"_score": 12.5,
"_highlights": {
"title": ["Stirling <mark>Castle</mark>"]
},
"title": "Stirling Castle",
"country": "Scotland"
}
],
"totalHits": 42,
"page": 1,
"perPage": 20,
"totalPages": 3,
"facets": {
"country": [
{ "value": "Scotland", "count": 18 },
{ "value": "England", "count": 15 }
]
},
"suggestions": []
}
FieldTypeDescription
hitsSearchHit[]Array of matching documents.
totalHitsnumberTotal number of matching documents.
pagenumberCurrent page number (1-based).
perPagenumberResults per page.
totalPagesnumberTotal number of pages.
facetsRecord<string, FacetValue[]>Facet aggregations keyed by field name.
histogramsRecord<string, Bucket[]>?Histogram aggregations (when requested).
geoClustersGeoCluster[]?Geo tile grid results (when requested).
suggestionsstring[]Spelling/phrase suggestions.

Each hit contains all document fields plus metadata: objectID, _index, _score, and _highlights.

Terminal window
curl "https://search-api-elysia-production.up.railway.app/collections/search?q=castle"
Terminal window
curl "https://search-api-elysia-production.up.railway.app/collections/search?q=castle&page=2&perPage=10&sort=%7B%22title%22%3A%22asc%22%7D"

The sort param decoded: {"title":"asc"}

Terminal window
curl "https://search-api-elysia-production.up.railway.app/collections/search?q=&facets=country,region&filters=%7B%22country%22%3A%22Scotland%22%7D"
Terminal window
curl "https://search-api-elysia-production.up.railway.app/collections/search?q=castle&highlight=true"
Terminal window
curl "https://search-api-elysia-production.up.railway.app/collections/search?q=castle&fields=title,country"
Terminal window
curl "https://search-api-elysia-production.up.railway.app/collections/search?q=castle&boosts=%7B%22title%22%3A10%2C%22description%22%3A2%7D"

The boosts param decoded: {"title":10,"description":2}

StatusCondition
400Invalid JSON in sort, filters, boosts, histogram, or geoGrid
401Missing or invalid bearer token
404Index handle not found