Implementing full-text search with Elasticsearch
Full-text search is an essential part of almost all use cases that are catered to via web applications. It becomes much more crucial if you intend to build an e-commerce platform or something similar where search plays a central role. Full-text search means an ability to search some text inside a large amount of textual data where the search results can contain full or partial matches as per configuration.
Elasticsearch is a search server based on Lucene, which is an open source information-retrieval library. Elasticsearch provides a distributed full-text search engine with a RESTful web interface and schema-free JSON documents. In this recipe, we will implement full-text search using Elasticsearch for our Flask application.
Getting ready
We will use a Python library called elasticsearch
, which makes dealing with Elasticsearch a lot easier:
$ pip install elasticsearch
We also need to install the Elasticsearch server itself...