You would have seen in a movie data store like IMDB, whenever a user enters ‘g’, the search bar suggests him that you might be looking for gone girl or all the movies that have ‘g’ in them. This is what an Autocomplete or word completion is and it has become an essential part of any application. Autocomplete speeds up human-computer interaction by predicting the word using very few characters.
In this blog, I’ll be discussing result suggest autocomplete using Elasticsearch which means that the predictions would be based on the existing data in the data store.
(There is another type of autocomplete i.e search suggest autocomplete which works on the previously searched phrases but we won’t be discussing it in this blog.)
Whenever we insert data into Elasticsearch, it analyzes the data so that an appropriate inverted index can be created.
The Analyzers consists of a tokenizer and one or more token filter which transform the data appropriately so that the business needs are met.
N-gram is a contiguous sequence of n items from a given sequence of text. This means that we are breaking the search text into character permutations.