Connecting to Elasticsearch with Python

For Legacy Support Purposes Only

In this example, we will use Python OpenSearch client library. 

Prerequisites

You need to install Python on your machine. Depending on your operating system, download and install python. Note: This sample code uses Python3.

  1. Installation

Install Python OpenSearch client package using pip

  2. Connecting to cluster

# SSL client authentication using client_cert and client_key

  3. Indexing
  4. Getting a document

Full sample code

Replace public IP, username and password with your real setting

 

Transparent, fair, and flexible pricing for your data infrastructureSee Instaclustr Pricing Here