Registry / database / elasticsearch8-dsl

elasticsearch8-dsl

JSON →
library8.12.0pypypiunverified

Elasticsearch DSL is a high-level Python library for Elasticsearch 8.x that provides a fluent, object-oriented way to construct queries, aggregations, and manage documents. It wraps the low-level elasticsearch-py client. The current version is 8.12.0 with a release cadence of several minor versions per year. Note: Starting from v8.18.0, development has moved to the official elasticsearch-py repo; this package (elasticsearch8-dsl) is a community fork.

pip install elasticsearch8-dsl
INSTALL
IMPORT
SIG · ELASTICSEARCH8-DSL
E
elasticsearch8-dsl
databasepythonv8.12.0
Install
2.6s avg
Import
Disk
30MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v8.12.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 31.4MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.6s · import 0.000s · 32MB
30MB installed
● package 30MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Search
from elasticsearch8_dsl import Search
from elasticsearch_dsl import Search

Create an Elasticsearch client, build a search query using the DSL, execute it, and print results.

from elasticsearch import Elasticsearch from elasticsearch_dsl import Search, Q # Create an Elasticsearch client (set auth via env vars for security) client = Elasticsearch( hosts=[os.environ.get('ELASTICSEARCH_HOST', 'http://localhost:9200')], http_auth=(os.environ.get('ELASTICSEARCH_USER', 'elastic'), os.environ.get('ELASTICSEARCH_PASSWORD', 'changeme')) ) # Build a search request search = Search(using=client, index='my-index').query('match', title='python') # Execute and iterate over hits response = search.execute() for hit in response: print(hit.title, hit.meta.score) # Or use the Q shortcut: s = Search(using=client).query(Q('bool', must=[Q('match', title='python'), Q('range', price={'gte': 100})])) print(s.count())
Debug
Known issues
deprecatedThis package is a community fork; official Elasticsearch DSL development has moved to the elasticsearch-py repo starting v8.18.0. New features and fixes will not land here. Consider migrating to the official package.
fix
Install elasticsearch-dsl from the official repo: pip install elasticsearch-dsl, and update your import statements. See migration docs at https://www.elastic.co/docs/reference/elasticsearch/clients/python/dsl_migrating
affects: *
gotchaThe 'elasticsearch8-dsl' package is versioned separately from the official DSL. The version listed here (8.12.0) corresponds to the compatibility with Elasticsearch 8.x clients, but the official package may have different version numbers.
fix
Always check the compatible versions in the package metadata. Use 'pip show elasticsearch8-dsl' to verify.
affects: 8.x
gotchaWhen using the 'Terms' query with a dictionary value, ensure the dictionary is passed as a list of dictionaries, not as a single dict. A regression existed in 8.15.0 and was fixed in 8.15.4.
fix
Upgrade to elasticsearch8-dsl>=8.15.4.
affects: 8.15.0 - 8.15.3
Upgrade
Version history
8.12.0latest on PyPI · released Jan 19, 2024
Audit
Dependencies
elasticsearch8requiredThe DSL depends on the low-level elasticsearch Python client for the specified version (8.x).
Agent activity
13 hits · last 30 days
node
10
OpenAI (training)
2
Resources
elasticsearch8-dsl — pip install elasticsearch8-dsl · libregistry