Storing data in Elasticsearch
Elasticsearch is a search engine based on Lucene. It provides a distributed, multitenant-capable, full-text search engine with an HTTP web interface and schema-free JSON documents. It is a non-relational database (often stated as NoSQL), focusing on the storage of documents instead of records. These documents can be many formats, one of which is useful to us: JSON. This makes using Elasticsearch very simple as we do not need to convert our data to/from JSON. We will use Elasticsearch much more later in the book
For now, let's go and store our planets data in Elasticsearch.
Getting ready
We will access a locally installed Elasticsearch server. To do this from Python, we will use the Elasticsearch-py
library. It is most likely that you will need to install this using pip: pip install elasticsearch
.
Unlike PostgreSQL and MySQL, we do not need to create tables in Elasticsearch ahead of time. Elasticsearch does not care about structured data schemas (although it does...