Official Python client for OpenSearch — AWS's Apache 2.0 fork of Elasticsearch 7.10. Current version: 3.1.0 (Mar 2026). API is nearly identical to elasticsearch-py v7 but NOT interchangeable — different package, different import. OpenSearch 1.x deprecated May 2025. v3.0 client released alongside OpenSearch 3.0. Major footgun: developers import elasticsearch instead of opensearch_py by mistake. Also compatible with Amazon OpenSearch Service (AWS managed).
pip install opensearch-pyVerified import paths — ran on the pinned version, not inferred.
Minimal opensearch-py connection and CRUD.
pip install opensearch-py; from opensearchpy import OpenSearch
Use opensearch-py for OpenSearch/Amazon OpenSearch Service. Use elasticsearch for Elasticsearch.
from requests_aws4auth import AWS4Auth; client = OpenSearch(http_auth=AWS4Auth(...))
Target OpenSearch 2.x or 3.x for new projects.
client.search(index='my-index', body={'query': {...}}) — body= is correct for opensearch-py.Verify that your OpenSearch instance is running and listening on the correct host and port. Check network connectivity, host address, port number, and any firewall rules that might be blocking the connection from the client to the OpenSearch server.
Verify that the OpenSearch service is running on the specified host and port. Check your client configuration for the correct host and port. Ensure no firewall rules or network configurations are blocking the connection.