Connect to OpenSearch with Python

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-py client package using pip

To connect to clusters using HTTPS with the Python client, you will also need to install certifi:

  2. Connect to Cluster
  3. Indexing
  4. Getting a document
  5. Deleting a document and an index

Full sample code

Replace public IP, username and password with your real setting

 

By Instaclustr Support
Need Support?
Experiencing difficulties on the website or console?
Already have an account?
Need help with your cluster?
Contact Support
Why sign up?
To experience the ease of creating and managing clusters via the Instaclustr Console
Spin up a cluster in minutes