Full-text search with Elasticsearch

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 pyelasticsearch, which makes dealing with Elasticsearch a lot easier:

$ pip install pyelasticsearch

We also need to install the Elasticsearch server itself. This can be downloaded from http://www.elasticsearch.org/download/. Unpack the package downloaded and run the following command:

$ bin/elasticsearch

This will start the Elasticsearch server ...

Get Flask Framework Cookbook 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.