skillfed

django-opensearch-dsl

Wrapper around opensearch-py for django models

django-opensearch-dsl v0.8.0 116.5K downloads/30d#12,201 on PyPI38
Permissive license Apache Software License 2.0 AGING released

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

uv

uv add django-opensearch-dsl

poetry

poetry add django-opensearch-dsl

Installing 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

Development Status :: 4 - BetaEnvironment :: Web EnvironmentFramework :: DjangoFramework :: Django :: 4.2Framework :: Django :: 5.0Framework :: Django :: 5.1Framework :: Django :: 5.2Intended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseNatural Language :: EnglishProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.9

Tags

django opensearch indexingdjango full-text searchopensearch model integrationdjango search backendopensearch dsl djangodjango elasticsearch alternativemodel to opensearch sync
search-indexingdjango-integrationopensearch

More Front-Ends packages

SQLAlchemy

SQLAlchemy is a Python SQL toolkit and Object…

permissive · top 100 on PyPI

psycopg2-binary

psycopg2-binary is a PostgreSQL database…

copyleft · top 1,000 on PyPI

alembic

Alembic generates and manages database schema…

permissive · top 1,000 on PyPI

weaviate-client

A Python client library for connecting to and…

permissive · top 1,000 on PyPI

databricks-sql-connector

A Python client library that connects to…

permissive · top 1,000 on PyPI

psycopg

Psycopg 3 is a PostgreSQL database adapter for…

copyleft · top 1,000 on PyPI

opensearch-dsl

A Python client library for building and…

permissive · top 15,000 on PyPI

django-elasticsearch-dsl

Indexes Django model instances into…

permissive · top 15,000 on PyPI

opensearch-py

Python client library for connecting to and…

permissive · top 1,000 on PyPI

elasticsearch-dsl

Provides a high-level Python API for building…

permissive · top 5,000 on PyPI

opensearch-mcp-server-py

Provides a Model Context Protocol (MCP) server…

permissive · top 15,000 on PyPI

modelsearch

Indexes Django models into Elasticsearch,…

permissive · top 15,000 on PyPI

elasticsearch8-dsl

A high-level Python query builder for…

permissive · top 15,000 on PyPI

django-ordered-model

Adds ordering and reordering capabilities to…

permissive · top 15,000 on PyPI

apache-airflow-providers-opensearch

Integrates OpenSearch with Apache Airflow,…

permissive · top 15,000 on PyPI

opensearch-logger

Provides a Python logging handler that sends…

permissive · top 15,000 on PyPI