Search
All search routes take a search key, or a scoped key on an index with per-record access control. They return the same response shape: hits, total and timing, plus facets when you ask for them with facet_keys. Browse always counts the index’s facets.
Typeahead
Send the text typed so far. Captain answers each keystroke with spelling correction and prefix matching.
curl
Python
TypeScript
Cancel the previous request when a new keystroke arrives, and draw only the reply to the latest one.
Filters, sort and pages
filter takes an expression over the fields returned by List Filters, which also gives the operators each field accepts:
Operators: =, !=, <, <=, >, >=, IN, NOT IN, BETWEEN, EXISTS(field), combined with AND, OR, NOT and parentheses.
An expression that names an unknown field, or uses an operator the field does not support, returns 400 FILTER_INVALID with the position of the problem and what could come there.
sort: order by one sortable field,{"field": "price", "order": "asc"}, instead of relevance. On a geo field, give a point:{"field": "location", "near": {"lat": 40.71, "lng": -74.0}, "order": "asc"}puts the nearest records first, and each hit carriesgeo_distance_m. A search sorts its 1,000 most relevant records, and a geo sort on browse orders the first 100 matches. Add aWITHINfilter to cover every match: the reply’ssort.exactistruewhen the browse ordered all of them.pageandper_page: page through results, from page0, up toper_page50.prefer: lift records that match a condition without removing the others.group_by: one hit per value of a field, such as one product per variant family.kcounts groups.
How deep search goes
Search returns up to 1,000 results, with k or with pages. Every page of a query is a cut of one list, so page 2 never repeats or skips a record from page 1.
- Plain search: the first 100 results are the full ranking. Results 101 to 1,000 continue it with the rest of the matches, in a simpler keyword order.
sortand a geo sort: the 1,000 most relevant records, sorted. Records without the field come last, in relevance order.constraints: "strict": the 1,000 most relevant records, with records that fail a constraint removed.prefer: reorders the first 100 results. Results 101 to 1,000 stay in relevance order, so a preference never pulls a weak match to the top.group_by: groups come in the order of each group’s best record. A grouped search reads the 100 most relevant records, and further down the 1,000 when it needs more to fillkgroups. The reply’sgrouped.depthsays how many it read.
A page that ends past result 1,000 returns 400 PAGE_TOO_DEEP. To walk every match, for an export or a full catalog listing, use Browse with a filter, a sort, k and page.
Browse
curl
Python
TypeScript
Similar records
curl
Python
TypeScript
Multiple searches
Each entry names an index, a route (search, typeahead or browse, default search) and that route’s body.
curl
Python
TypeScript
Per-record access control
When records carry access lists, searches use scoped keys. A scoped key is minted for one end user and returns only the records that user may see. Suggestions and facet counts respect the same rule. Scores are never returned to a scoped key.
A write key can set a record’s access list, including making it public. Check the access fields in the integration before going live.