MCPcopy Index your code
hub / github.com/elastic/elasticsearch-py

github.com/elastic/elasticsearch-py @v9.4.1 sqlite

repository ↗ · DeepWiki ↗ · release v9.4.1 ↗
5,169 symbols 20,806 edges 318 files 2,343 documented · 45%
README
<img src="https://github.com/elastic/elasticsearch-py/raw/main/docs/images/logo-elastic-glyph-color.svg" width="20%" alt="Elastic logo" />

Elasticsearch Python Client

PyPI Version Python Versions Conda Version Downloads

Build Status on GitHub Buildkite Status on Buildkite Documentation Status

The official Python client for Elasticsearch.

Features

  • Translating basic Python data types to and from JSON
  • Configurable automatic discovery of cluster nodes
  • Persistent connections
  • Load balancing (with pluggable selection strategy) across available nodes
  • Failed connection penalization (time based - failed connections won't be retried until a timeout is reached)
  • Support for TLS and HTTP authentication
  • Thread safety across requests
  • Pluggable architecture
  • Helper functions for idiomatically using APIs together

Installation

Download the latest version of Elasticsearch or sign-up for a free trial of Elastic Cloud.

Refer to the Installation section of the getting started documentation.

Connecting

Refer to the Connecting section of the getting started documentation.

Usage


Compatibility

Language clients are forward compatible: each client version works with equivalent and later minor versions of Elasticsearch without breaking.

Compatibility does not imply full feature parity. New Elasticsearch features are supported only in equivalent client versions. For example, an 8.12 client fully supports Elasticsearch 8.12 features and works with 8.13 without breaking; however, it does not support new Elasticsearch 8.13 features. An 8.13 client fully supports Elasticsearch 8.13 features.

Elasticsearch version elasticsearch-py branch
main main
9.x 9.x
9.x 8.x
8.x 8.x

Elasticsearch language clients are also backward compatible across minor versions — with default distributions and without guarantees.

[!TIP] To upgrade to a new major version, first upgrade Elasticsearch, then upgrade the Python Elasticsearch client.

If you need to work with multiple client versions, note that older versions are also released as elasticsearch7 and elasticsearch8.

Documentation

Documentation for the client is available on elastic.co and Read the Docs.

Try Elasticsearch and Kibana locally

If you want to try Elasticsearch and Kibana locally, you can run the following command:

curl -fsSL https://elastic.co/start-local | sh

This will run Elasticsearch at http://localhost:9200 and Kibana at http://localhost:5601.

More information is available here.

Contributing

See CONTRIBUTING.md

License

This software is licensed under the Apache License 2.0. See NOTICE.

Extension points exported contracts — how you extend this code

Meta (Interface)
(no doc)
examples/quotes/src/models.tsx
Quote (Interface)
(no doc)
examples/quotes/src/models.tsx
Tag (Interface)
(no doc)
examples/quotes/src/models.tsx

Core symbols most depended-on inside this repo

_quote
called by 1174
elasticsearch/_sync/client/utils.py
perform_request
called by 574
elasticsearch/_sync/client/_base.py
perform_request
called by 569
elasticsearch/_async/client/_base.py
_render
called by 404
elasticsearch/esql/functions.py
get
called by 282
elasticsearch/dsl/_sync/index.py
mapped_field
called by 119
elasticsearch/dsl/document_base.py
render
called by 107
elasticsearch/esql/esql.py
execute
called by 102
elasticsearch/dsl/_sync/search.py

Shape

Method 2,677
Function 1,371
Class 1,070
Route 48
Interface 3

Languages

Python100%
TypeScript1%

Modules by API surface

elasticsearch/dsl/types.py404 symbols
elasticsearch/esql/functions.py224 symbols
elasticsearch/dsl/aggs.py198 symbols
elasticsearch/esql/esql.py153 symbols
elasticsearch/dsl/field.py149 symbols
elasticsearch/dsl/query.py141 symbols
test_elasticsearch/test_dsl/_sync/test_document.py103 symbols
test_elasticsearch/test_dsl/_async/test_document.py103 symbols
elasticsearch/_sync/client/ml.py76 symbols
elasticsearch/_async/client/ml.py76 symbols
elasticsearch/_sync/client/indices.py72 symbols
elasticsearch/_async/client/indices.py72 symbols

Dependencies from manifests, versioned

@elastic/request-converter8.15.2 · 1×
@eslint/js9.36.0 · 1×
@types/react19.1.13 · 1×
@types/react-dom19.1.9 · 1×
@vitejs/plugin-react5.0.3 · 1×
boostrap2.0.0 · 1×
bootstrap5.3.8 · 1×
eslint9.36.0 · 1×
eslint-plugin-react-hooks5.2.0 · 1×
eslint-plugin-react-refresh0.4.20 · 1×
globals16.4.0 · 1×
minimist1.2.6 · 1×

For agents

$ claude mcp add elasticsearch-py \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact