elasticsearch-dsl
Python client for Elasticsearch
What it is and what it does
Elasticsearch DSL is a high-level query builder that sits on top of the elasticsearch client. It lets you construct Elasticsearch queries and aggregations using Python method chains and class definitions instead of writing nested JSON dictionaries, making queries more readable and less error-prone. It also provides optional document persistence—you can define Python classes that map to Elasticsearch indices, with field types, custom methods, and automatic serialization.
As of version 8.18.0, this package is deprecated and its functionality has been integrated directly into the elasticsearch library. The 8.18.0 release automatically redirects imports, so existing code will continue to run, but new projects should use elasticsearch directly. The package is no longer actively maintained.
Use it for:
- Building complex search queries programmatically without manually constructing nested JSON structures.
- Defining Elasticsearch document schemas and mappings as Python classes with type hints and custom methods.
- Gradually migrating from raw elasticsearch dict-based queries by converting to Search objects and modifying them.
- Retrieving, saving, and managing documents as Python objects with automatic field mapping.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides a high-level Python API for building and executing Elasticsearch queries using a DSL instead of raw JSON, plus optional object-relational mapping for documents.
No—do not install this package for new projects. Version 8.18.0 is a deprecation notice: the package is abandoned and its functionality is now part of elasticsearch. Install elasticsearch directly instead. Existing code using older versions may continue to work, but migration is strongly recommended.
Install
elasticsearch-dsl on PyPI
pip
pip install elasticsearch-dsluv
uv add elasticsearch-dslpoetry
poetry add elasticsearch-dslInstalling elasticsearch-dsl
Before you install
Low install friction with four stable runtime dependencies. However, the package is abandoned as of 8.18.0 and functionality has been integrated into the official client; migration is recommended.
License in practice
Apache-2.0 permissive license allows commercial and private use with minimal restrictions.
Quickstart
pip install elasticsearch
from elasticsearch import Elasticsearch
from elasticsearch_dsl import Search
client = Elasticsearch("https://localhost:9200")
s = Search(using=client, index="my-index").filter("term", category="search")
response = s.execute()
Requires Elasticsearch server running and accessible; Python >=3.8.
Verify before relying
- Whether existing code using elasticsearch-dsl will continue to work without modification beyond import path changes.
- Long-term support timeline for the redirect shim in 8.18.0 before it is removed entirely.
- Compatibility guarantees between elasticsearch-dsl 8.18.0 and future elasticsearch versions.
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 4 — python-dateutil, typing-extensions, elasticsearch, elastic-transport |
| Maintenance | abandoned — 485 days since the last release |
| Last repo commit | (repository archived) |
| First released | |
| Downloads | 8,934,840/month — #1,575 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: elasticsearch_dsl-8.18.0-py3-none-any.whl
Tags
More Database packages
psycopg2-binary is a PostgreSQL database…
copyleft · top 1,000 on PyPI
redisPython client library for connecting to and…
permissive · top 1,000 on PyPI
ydbYDB Python SDK is the official client library…
permissive · top 1,000 on PyPI
snowflake-connector-pythonConnects Python applications to Snowflake data…
permissive · top 1,000 on PyPI
sqlparsesqlparse tokenizes SQL text into a tree of…
permissive · top 1,000 on PyPI
dbt-adaptersProvides base adapter protocols and shared…
permissive · top 1,000 on PyPI
django-elasticsearch-dslIndexes Django model instances into…
permissive · top 15,000 on PyPI
elasticsearch8-dslA high-level Python query builder for…
permissive · top 15,000 on PyPI
luqumParses Lucene Query DSL syntax into an abstract…
unclear · top 5,000 on PyPI
django-elasticsearch-dsl-drfProvides Django REST framework views,…
copyleft · top 15,000 on PyPI
opensearch-dslA Python client library for building and…
permissive · top 15,000 on PyPI
elasticsearch6Low-level Python client for Elasticsearch that…
permissive · top 15,000 on PyPI
es-clientBuilds and validates Elasticsearch client…
permissive · top 15,000 on PyPI
elasticsearchOfficial Python client library for connecting…
permissive · top 1,000 on PyPI
django-opensearch-dslIndexes Django model instances into OpenSearch…
permissive · top 15,000 on PyPI
elasticsearch5Low-level Python client for Elasticsearch 5.x…
permissive · top 15,000 on PyPI