--- id: django-haystack version: "3.4.0" license: BSD-3-Clause license_treatment: permissive maintenance: active --- # django-haystack — Pluggable search for Django. License: permissive · Maintenance: active · Downloads: 204.9K/mo ## 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 above — verify before relying. Haystack provides a unified search API for Django that lets you swap between different search backends (Solr, Elasticsearch, Whoosh, Xapian, etc.) without changing your application code. 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 pip install django-haystack uv add django-haystack poetry add django-haystack ## Installing django-haystack 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. 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') Requires a search backend (Solr, Elasticsearch, Whoosh, or Xapian) to be installed, configured, and running separately; Haystack is an abstraction layer only. 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_current - Install friction: high - Maintenance: active - Downloads: 204.9K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags django search abstraction layer, pluggable search backends django, elasticsearch solr whoosh django, unified search api django, faceted search django, django search indexing, search-abstraction, django-integration [View on SkillFed](https://skillfed.io/packages/django-haystack) · [View on PyPI](https://pypi.org/project/django-haystack/)