Autocomplete in Elasticsearch

Autocomplete provides suggestions while you type in a field. This feature is immensely helpful during search operations as it saves a user's time and also enables them to see various other related options in a single stretch. A prefix query is one way to implement this. A prefix query matches documents that have fields containing terms with the same prefix.

It is natural for you to think why we don't use a prefix query to solve the autocomplete problem or rather, what is the requirement for a separate API and module to implement autocomplete. The primary reason here is performance. The ideal data structure for autocomplete would be finite state automata (FST), which is explained in the following section, but then we ...

Get Elasticsearch Blueprints now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.