Book Image

ElasticSearch Blueprints

Book Image

ElasticSearch Blueprints

Overview of this book

Table of Contents (15 chapters)
Elasticsearch Blueprints
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Hotel suggester using autocomplete


Let's take the scenario of a site like Zomato, which helps us to search hotels. As the first step, an autocomplete suggestion needs to be employed. When the user types, the autosuggester should be able to complete or give suggestions for the hotel names the end user tries to type in. The characteristics of this feature are as follows:

  • It should be able to do a prefix match, that is a string such as hot should suggest Hotel Holiday Inn and Hotel Summer Holiday Homes.

  • It should be able to map multiple prefixes, that is for a string sum, it should be able to suggest Hotel Summer Holiday Homes. Also, it should be case insensitive.

  • It doesn't need index/type/ID information. It just needs the suggested text.

  • It should be super fast.

An example of autocomplete is shown in the following figure for the word chick:

With this requirement in mind, let's see how we can implement this in Elasticsearch.

Elasticsearch offers you an out-of-the-box autocomplete feature. Remember...