django-elasticsearch-dsl-drf
Integrate Elasticsearch DSL with Django REST framework.
What it is and what it does
django-elasticsearch-dsl-drf bridges Elasticsearch DSL and Django REST framework, letting you expose Elasticsearch documents as REST API endpoints without writing boilerplate views or serializers. It provides pre-built filter backends for search, ordering, filtering, geo-spatial queries, faceting, and highlighting, plus pagination and aggregation support. You define your Elasticsearch documents using django-elasticsearch-dsl, then use this package's viewsets and serializers to turn them into queryable REST endpoints.
The package handles the integration layer between two mature ecosystems: it takes your Elasticsearch document definitions and automatically generates REST-compatible serializers, then provides filter backends that translate query parameters into Elasticsearch DSL queries. This is useful when you want full-text search, complex filtering, or faceted navigation in a Django REST API without manually translating HTTP requests into Elasticsearch queries.
Use it for:
- Build a full-text search API endpoint that accepts query strings and returns ranked results with highlighting.
- Create a product catalog API with faceted filtering by category, price range, and geo-spatial distance.
- Expose Elasticsearch aggregations as REST endpoints for analytics dashboards or reporting.
- Implement auto-complete or suggestion endpoints using Elasticsearch suggesters.
- Add complex filtering (range, prefix, wildcard, exists) to a Django REST API without custom query logic.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides Django REST framework views, serializers, and filter backends to expose Elasticsearch documents as REST APIs with search, filtering, ordering, pagination, and aggregation support.
Yes, with conditions. The package is stable and well-documented for integrating Elasticsearch with Django REST framework, with no known vulnerabilities. However, maintenance is dormant (last release 2022-07-03), so it is best suited for projects on Django 2.2, 3.1, or 3.2 and Elasticsearch 6.x or 7.x that do not require active support. If you need compatibility with newer versions, verify compatibility first or consider alternatives.
Install
django-elasticsearch-dsl-drf on PyPI
pip
pip install django-elasticsearch-dsl-drfuv
uv add django-elasticsearch-dsl-drfpoetry
poetry add django-elasticsearch-dsl-drfInstalling django-elasticsearch-dsl-drf
Before you install
Low friction install with six runtime dependencies. Maintenance is dormant—last release was 2022-07-03, though the repository remains active with a recent commit on 2024-08-10. Suitable for stable use cases but expect no active development.
License in practice
Dual-licensed under GPL-2.0-only or LGPL-2.1-or-later (copyleft). Use requires compliance with one of these licenses; derivative works or distribution must include source code and license terms.
Quickstart
pip install django-elasticsearch-dsl-drf
# In Django settings.py, add to INSTALLED_APPS:
# 'rest_framework', 'django_elasticsearch_dsl', 'django_elasticsearch_dsl_drf'
from django_elasticsearch_dsl_drf.viewsets import DocumentViewSet
from django_elasticsearch_dsl_drf.serializers import DocumentSerializer
class MyDocumentViewSet(DocumentViewSet):
serializer_class = DocumentSerializer
Requires Elasticsearch 6.x or 7.x running and accessible; Django 2.2, 3.1, or 3.2; Python 3.6, 3.7, 3.8, or 3.9.
Verify before relying
- Whether the package works with Elasticsearch 8.x or later versions beyond 7.x.
- Current compatibility with Python 3.10+ and Django 4.0+.
- Whether dormant status means security patches are still applied or if vulnerabilities would go unaddressed.
Package facts
| License | GPL-2.0-only OR LGPL-2.1-or-later (copyleft) |
| Python support | supports the current Python release (>=2.7) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 6 — six, django-nine, django-elasticsearch-dsl, elasticsearch-dsl, elasticsearch, djangorestframework |
| Maintenance | dormant — 1,503 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 138,983/month — #11,313 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: django_elasticsearch_dsl_drf-0.22.5-py2.py3-none-any.whl
Keywords: django, elasticsearch, elasticsearch-dsl, django rest framework
Tags
More Dynamic Content packages
MarkupSafe provides a text object that escapes…
permissive · top 100 on PyPI
Jinja2Jinja2 is a templating engine that renders…
permissive · top 100 on PyPI
soupsieveSoupsieve is a CSS selector library designed to…
permissive · top 100 on PyPI
WerkzeugWerkzeug is a WSGI utility library providing…
permissive · top 1,000 on PyPI
FlaskFlask is a lightweight WSGI web application…
permissive · top 1,000 on PyPI
MakoMako compiles Python-embedded templates into…
permissive · top 1,000 on PyPI
django-elasticsearch-dslIndexes Django model instances into…
permissive · top 15,000 on PyPI
djangorestframework-datatablesAdds server-side Datatables support to Django…
permissive · top 15,000 on PyPI
elasticsearch-dslProvides a high-level Python API for building…
permissive · top 5,000 on PyPI
fastapi-filterAdds declarative filtering, sorting, and…
permissive · top 15,000 on PyPI
elasticsearch8-dslA high-level Python query builder for…
permissive · top 15,000 on PyPI
djangorestframeworkBuilds web APIs on top of Django with…
permissive · top 1,000 on PyPI
drf-dynamic-fieldsProvides a Django REST Framework mixin that…
permissive · top 15,000 on PyPI
django-filterDjango-filter adds dynamic QuerySet filtering…
permissive · top 5,000 on PyPI
django-haystackHaystack provides a unified search API for…
permissive · top 15,000 on PyPI
djangorestframework-filtersExtends Django REST Framework with advanced…
permissive · top 15,000 on PyPI