What’s the best way to add autocomplete and intent detection to Elasticsearch search?
Asked by
MellowCedar42
Elasticsearch works well when users submit complete queries, but many people only type one or two words. I'm looking for a practical way to help users discover better search terms and capture their intent before sending a request to Elasticsearch, without replacing it with another hosted search backend due to cost concerns. I'm considering either improving the Elasticsearch query on the backend or adding an autocomplete and intent layer directly in the search box to turn fragments into filters or structured parameters. Has anyone implemented this successfully, and what approach worked best?
Answers
A lightweight intent layer can work well without replacing Elasticsearch. As the user types, classify the fragment into structured filters and possibly expand useful synonyms, then run a hybrid Elasticsearch query using exact keyword matches, semantic similarity, and those filters. For very short queries, generating a richer hypothetical description before vector search can improve recall, but I’d use that selectively rather than on every keystroke.
Reply to this answer
The right choice depends on what the product actually needs. Sometimes the biggest improvement is simply a fast, polished dropdown with useful suggestions, recent searches, and filters. Users may care more about immediate feedback and clear guidance than an elaborate search architecture.
Reply to this answer
Before adding an AI service, try Elasticsearch’s completion suggester. Put popular past queries, titles, or other suggestion text in a dedicated suggest field, then rank suggestions by frequency or click-through rate. It’s fast and handles the common prefix-search case well. An embedding or AI layer makes more sense when you need semantic intent beyond typo-tolerant matching, but it also adds latency and infrastructure cost.
Reply to this answer
Add your answer
Answers are reviewed before publication.
MellowCedar42: That’s fair. I’m trying to balance the underlying search quality with an interface that feels simple and responsive, so starting with the dropdown experience may be the most sensible step.