django-opensearch-dsl
Wrapper around opensearch-py for django models
What it is and what it does
Django OpenSearch DSL is a thin wrapper around opensearch-py that allows you to define and manage search indices for Django models. It lets you declaratively map Django model fields to OpenSearch document fields, then automatically keep those indices in sync via Django signals or asynchronous Celery tasks. The package handles index creation, deletion, population, and field mapping—including complex types like nested and object fields—and provides management commands for administrative operations.
You define Document classes that specify which model fields to index and how to configure the OpenSearch index itself (shards, replicas, refresh behavior). The package then manages synchronization: when a model instance is saved or deleted, the corresponding OpenSearch document is updated in real time or queued for async processing. You can query indices using the Search object from opensearch-py, making full-text search, filtering, and aggregations available to your Django application.
Use it for:
- Add full-text search to a Django application by indexing model fields and querying them via OpenSearch
- Implement autocomplete or faceted search by leveraging OpenSearch aggregations on indexed model data
- Decouple search from the primary database by maintaining a separate OpenSearch index synchronized via signals
- Perform complex text analysis and linguistic queries that SQL databases cannot efficiently handle
- Scale search performance independently of the main database by tuning OpenSearch shards and replicas per index
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Indexes Django model instances into OpenSearch and provides management commands and automatic signal handlers to keep indices synchronized with database changes.
Yes, with conditions. The package is suitable if you need full-text search in a Django application and are willing to operate an OpenSearch cluster. Install friction is high (requires opensearch-py and a running server), and maintenance is aging (263 days since last release), but the repository is not archived and supports current Django and Python versions. No known vulnerabilities. Use it when SQL-based search is insufficient and you can commit to maintaining an OpenSearch deployment.
Install
django-opensearch-dsl on PyPI
pip
pip install django-opensearch-dsluv
uv add django-opensearch-dslpoetry
poetry add django-opensearch-dslInstalling django-opensearch-dsl
Before you install
High install friction due to opensearch-py and python-dateutil dependencies. Maintenance status is aging—last release 263 days ago, though repository remains active with recent commits and no archived status. Supports Django 4.2 through 5.2 and Python 3.9 through 3.13.
License in practice
Apache Software License 2.0 is permissive, allowing commercial use and modification with minimal restrictions. Suitable for most projects without license compatibility concerns.
Quickstart
pip install django-opensearch-dsl
# In Django settings:
OPENSEARCH_DSL = {'default': {'hosts': 'localhost:9200'}}
# In documents.py:
from django_opensearch_dsl import Document
from django_opensearch_dsl.registries import registry
@registry.register_document
class MyModelDocument(Document):
class Index:
name = 'myindex'
class Django:
model = MyModel
fields = ['name', 'description']
Requires a running OpenSearch instance (localhost:9200 by default). OpenSearch server must be accessible and properly configured before indexing operations.
Verify before relying
- Performance characteristics of parallel indexing relative to sequential indexing for large datasets
- Compatibility guarantees with specific OpenSearch versions beyond the referenced compatibility matrix
- Memory overhead and query performance impact when indexing complex nested or object fields
Package facts
| License | Apache Software License 2.0 (permissive) |
| Python support | not specified |
| Install friction | high — source build required |
| Runtime dependencies | 2 — opensearch-py, python-dateutil |
| Maintenance | aging — 263 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 116,474/month — #12,201 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: django_opensearch_dsl-0.8.0.tar.gz
Keywords: django, elasticsearch, elasticsearch-dsl, opensearch, opensearch-dsl, opensearch-py
Tags
More Front-Ends packages
SQLAlchemy is a Python SQL toolkit and Object…
permissive · top 100 on PyPI
psycopg2-binarypsycopg2-binary is a PostgreSQL database…
copyleft · top 1,000 on PyPI
alembicAlembic generates and manages database schema…
permissive · top 1,000 on PyPI
weaviate-clientA Python client library for connecting to and…
permissive · top 1,000 on PyPI
databricks-sql-connectorA Python client library that connects to…
permissive · top 1,000 on PyPI
psycopgPsycopg 3 is a PostgreSQL database adapter for…
copyleft · top 1,000 on PyPI
opensearch-dslA Python client library for building and…
permissive · top 15,000 on PyPI
django-elasticsearch-dslIndexes Django model instances into…
permissive · top 15,000 on PyPI
opensearch-pyPython client library for connecting to and…
permissive · top 1,000 on PyPI
elasticsearch-dslProvides a high-level Python API for building…
permissive · top 5,000 on PyPI
opensearch-mcp-server-pyProvides a Model Context Protocol (MCP) server…
permissive · top 15,000 on PyPI
modelsearchIndexes Django models into Elasticsearch,…
permissive · top 15,000 on PyPI
elasticsearch8-dslA high-level Python query builder for…
permissive · top 15,000 on PyPI
django-ordered-modelAdds ordering and reordering capabilities to…
permissive · top 15,000 on PyPI
apache-airflow-providers-opensearchIntegrates OpenSearch with Apache Airflow,…
permissive · top 15,000 on PyPI
opensearch-loggerProvides a Python logging handler that sends…
permissive · top 15,000 on PyPI