Prompt
search with facets and autocomplete
Latest observation
Oct 4, 2026
OpenAI APIWeb search: off
Sure — if you want search with facets and autocomplete, here’s the typical pattern.
What it means
- Search: full-text query over items/documents
- Facets: filters like category, brand, price range, tags
- Autocomplete: suggestions as the user types
Common architecture
-
Index your data in a search engine
- Elasticsearch / OpenSearch
- Algolia
- Meilisearch
- Typesense
- Azure AI Search
-
Store searchable fields
title,description,tags- facet fields like
category,brand,price,rating
-
Autocomplete endpoint
- returns suggested queries or matching items
- usually triggered on each keystroke with debounce
-
Faceted search endpoint
- accepts query + facet filters
- returns matching results + facet counts
Example API shape
Autocomplete
GET /search/autocomplete?q=iph
Response:
{
"suggestions": [
"iphone 15",
"iphone 15 pro",
"iphone charger"
]
}
Search with facets
GET /search?q=iphone&category=phones&brand=apple&price_min=500&price_max=1500
Response:
{
"results": [
{
"id": 1,
"title": "iPhone 15 Pro"
}
],
"facets": {
"brand": [
{ "value": "Apple", "count": 120 }
],
"category": [
{ "value": "Phones", "count": 80 }
]
},
"total": 80
}
If you’re using Elasticsearch/OpenSearch
You’d typically use:
match/multi_matchfor searchtermsaggregations for facetssuggest,completion, or edge n-grams for autocomplete
If you’re using Algolia
You get this almost out of the box:
- facets via
attributesForFaceting - autocomplete via searchable attributes + typo tolerance + query suggestions
If you want, I can help with any of these:
- Design the API
- Implement in Elasticsearch/OpenSearch
- Implement in Algolia
- Implement in React/Next.js UI
- Implement in SQL + backend
- Add autocomplete + facets to an existing app
If you tell me your stack, I can give you a concrete implementation.