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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access