django-haystack
Pluggable search for Django.
Decision gist · record as of 2026-08-14
Yes, if you are building a Django application that needs search and want the flexibility to choose or change search backends. The high install friction (requires a separate search engine and Python 3.9+, Django 4–5) is justified by the abstraction benefit. Active maintenance, no known vulnerabilities, and permissive licensing make it a safe choice. Not worth installing if you need a simple, built-in search solution or are not willing to operate a separate search service.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires a search backend (Solr, Elasticsearch, Whoosh, or Xapian) to be installed, configured, and running separately; Haystack is an abstraction layer only.
- High install friction: requires Django 4–5 and Python 3.9+, plus a separate search backend (Solr, Elasticsearch, Whoosh, or Xapian) to be installed and configured independently.
- The package itself is actively maintained with recent commits and stable status.
License · maintenance · safety
BSD-3-Clause (permissive) — BSD-3-Clause is permissive; you can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.
last release 2026-06-04 (71 days) · last repo commit 2026-08-14 · 3,739 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 204,948 downloads/mo, #9,596 on PyPI
Alternatives
Verify before relying
pip install django-haystack
from haystack import indexes
from haystack.query import SearchQuerySet
# Define a search index for your model
class MyModelIndex(indexes.SearchIndex, indexes.Indexable):
text = indexes.CharField(document=True, use_template=True)
# Query via the unified API
results = SearchQuerySet().filter(content='search term')- Whether faceting, More Like This, highlighting, spatial search, and spelling suggestions are fully supported across all backends or have backend-specific limitations.
- Current state of community support and response time on the mailing list or issue tracker.
What it is and what it does
Haystack is a search abstraction layer for Django that decouples your application from any specific search engine. Instead of writing search code tied to Elasticsearch or Solr, you write against Haystack's unified API and can swap backends without touching your code. It sits between your Django models and external search engines, handling indexing, querying, and result marshaling.
The package supports advanced search features like faceting, result highlighting, spelling suggestions, and spatial search. However, it is not a search engine itself—you must install and run a separate backend (Solr, Elasticsearch, Whoosh, or Xapian) and configure Haystack to connect to it. This makes it a good fit for teams that want flexibility in their search infrastructure or may need to migrate between engines later.
Use it for
- Build a Django site with Elasticsearch search today, then switch to Solr tomorrow without rewriting search code.
- Add faceted search (filtering by category, date, price) to a Django e-commerce or content site.
- Index and search large document collections with spelling correction and result highlighting.
- Implement 'More Like This' recommendations by querying similar documents in your search backend.
- Support spatial/geographic search queries across Django models without backend-specific code.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you are building a Django application that needs search and want the flexibility to choose or change search backends.
The high install friction (requires a separate search engine and Python 3.9+, Django 4–5) is justified by the abstraction benefit. Active maintenance, no known vulnerabilities, and permissive licensing make it a safe choice. Not worth installing if you need a simple, built-in search solution or are not willing to operate a separate search service.
Install
django-haystack on PyPI
Before you install
High install friction: requires Django 4–5 and Python 3.9+, plus a separate search backend (Solr, Elasticsearch, Whoosh, or Xapian) to be installed and configured independently. The package itself is actively maintained with recent commits and stable status.
Requires a search backend (Solr, Elasticsearch, Whoosh, or Xapian) to be installed, configured, and running separately; Haystack is an abstraction layer only.
License in practice
BSD-3-Clause is permissive; you can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.
Quickstart
pip install django-haystack
from haystack import indexes
from haystack.query import SearchQuerySet
# Define a search index for your model
class MyModelIndex(indexes.SearchIndex, indexes.Indexable):
text = indexes.CharField(document=True, use_template=True)
# Query via the unified API
results = SearchQuerySet().filter(content='search term')
Verify before relying
- Whether faceting, More Like This, highlighting, spatial search, and spelling suggestions are fully supported across all backends or have backend-specific limitations.
- Current state of community support and response time on the mailing list or issue tracker.
Package facts
| License | BSD-3-Clause permissive |
| Python support | Supports the current Python release >=3.9 |
| Install friction | High. Source build required |
| Runtime dependencies | 2 packagesDjangopackaging |
| Maintenance | Actively maintained 71 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 204,948 / month, #9,596 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableEnvironment :: Web EnvironmentFramework :: DjangoFramework :: Django :: 4.2Framework :: Django :: 5.1Framework :: Django :: 5.2Intended Audience :: DevelopersOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9Programming Language :: Python :: Free ThreadingTopic :: Utilities |
Evidence: django_haystack-3.4.0.tar.gz
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “django search abstraction layer”
- django-haystackHaystack provides a unified search API for Django that lets you swap…
- django-service-objectsProvides a Service base class for Django that encapsulates business…
- django-anymailSends and receives email in Django through multiple transactional…
Give your agent the search over MCP, or paste the wish link into any chat.
More Utilities packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Detects and normalizes text encoding from unknown or ambiguous sources, supporting all IANA character sets that Python's core library provides codecs for, with the ability to register custom codecs.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
Pygments is a syntax highlighter that colorizes source code and text in over 500 languages and formats, outputting to HTML, LaTeX, RTF, SVG, images, or ANSI terminal sequences.
Install it if you need to display or transform source code.
Six provides utility functions to write Python code that runs on both Python 2.7 and Python 3.3+, smoothing over language differences between the two versions.
See also modelsearch · farm-haystack · Whoosh · Whoosh-Reloaded · haystack-ai · django-elasticsearch-dsl-drf · django-elasticsearch-dsl · pysolr · haystack-experimental · django-tastypie