All you need to know about using Elasticsearch in Python

Learn to build a search engine in Python

Lynn G. Kwong
8 min readApr 2, 2021
Elasticsearch and Python

In this article, we are going to talk about how to use Elasticsearch in Python. As a data engineer, you may need to create Elasticsearch documents in Python with some scripts. As a software engineer, when you design your API in Python, you would need to make REST API calls to Elasticsearch to fetch the data. Therefore, if you are using Elasticsearch in your work or plan to learn it, this article can be useful for you.

If you haven’t installed Elasticsearch yet, you can go to the official website of Elasticsearch and download and install Elasticsearch and Kibana on your computer.

Alternatively, if you don’t want to install Elasticsearch and Kibana on your computer, you can choose to use Docker containers for local development. If you haven’t installed Docker and docker-compose yet, you can download them from the official Docker website and install them accordingly. I highly recommend using Docker containers for local development because they are platform-independent and do not have library dependency issues on your computer and thus are easy to maintain. You can use this docker-compose file to start Elasticsearch and Kibana directly.

--

--

Lynn G. Kwong

I’m a Software Developer (https://medium.com/@lynn-kwong) keen on sharing thoughts, tutorials, and solutions for the best practice of software development.