skillfed

django-elasticsearch-dsl-drf

Integrate Elasticsearch DSL with Django REST framework.

django-elasticsearch-dsl-drf v0.22.5 139.0K downloads/30d#11,313 on PyPI379
Copyleft license GPL-2.0-only OR LGPL-2.1-or-later DORMANT released

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-drf

uv

uv add django-elasticsearch-dsl-drf

poetry

poetry add django-elasticsearch-dsl-drf

Installing 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

Development Status :: 4 - BetaEnvironment :: Web EnvironmentFramework :: DjangoIntended Audience :: DevelopersLicense :: OSI Approved :: GNU General Public License v2 (GPLv2)License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)Operating System :: OS IndependentProgramming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9

Tags

elasticsearch rest api djangodjango rest framework elasticsearchelasticsearch dsl django viewselasticsearch search filtering djangoelasticsearch pagination django restelasticsearch aggregations django apielasticsearch faceted search django
elasticsearch-integrationrest-api-frameworksearch-backend

More Dynamic Content packages