How it works

Elasticsearch is both a NoSQL database and a search engine. You give documents to Elasticsearch and it parses the data in the documents and creates search indexes for that data automatically.

During the insertion process, we used the elasticsearch libraries' .index() method and specified an index, named "planets", a document type, planets_info, and the finally the body of the document, which is our planet Python object. The elasticsearch library that object to JSON and sends it off to Elasticsearch for storage and indexing.

The index parameter is used to inform Elasticsearch how to create an index, which it will use for indexing and which we can use to specify a set of documents to search for when we query. When we performed ...

Get Python Web Scraping 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.