The official Python client for Elasticsearch versions 8.x and later. It provides a low-level client for interacting with the Elasticsearch REST API, supporting both synchronous and asynchronous operations. The current version is 8.19.3, and it follows the Elasticsearch release cycle for major updates.
pip install elasticsearch8Verified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to connect to Elasticsearch (either Elastic Cloud or self-managed), index a simple document, and perform a basic search. It uses environment variables for secure credential management. Remember to replace placeholder credentials with your actual ones.
Always use `from elasticsearch import Elasticsearch` after `pip install elasticsearch8`.
Review the official migration guide for `elasticsearch-py` v8.x. Update `request_timeout` to `timeout`, explicitly manage connection details instead of relying on sniffing, and ensure proper CA certificates are configured for production environments or set `verify_certs=False` (with caution) for development.
Use `from elasticsearch import AsyncElasticsearch` and ensure your application's event loop is managed correctly. `httpx` is used as the underlying async HTTP client.
For production, ensure your system trusts the CA certificate used by Elasticsearch. For development, you can temporarily disable verification with `verify_certs=False` in the client constructor, but this is highly insecure for production use.
Always provide appropriate authentication details. For Elastic Cloud, generate an API Key. For self-managed, ensure the provided username/password has necessary permissions. Avoid hardcoding credentials in code; use environment variables.
Remove `doc_type` from all client methods (e.g., `index`, `get`, `update`, `delete`). Elasticsearch 8.x operates on a single type per index, simplifying interactions.
No dependency data recorded yet.