An opensearch-py based search backend for django-haystack
Project description
django-haystack-opensearch
An OpenSearch backend for django-haystack.
Documentation: https://django-haystack-opensearch.readthedocs.io
django-haystack-opensearch provides a drop-in replacement for Elasticsearch
backends, allowing you to use OpenSearch (versions 1.x through 3.x) as your
search engine with
django-haystack.
It uses the opensearch-py client library only, instead of the out-of-date
elasticsearch client library.
Core Features
- Full-Text Search with OpenSearch: Powerful full-text search capabilities with support for complex queries and relevance scoring.
- Faceting and Filtering: Support for field, date, and query facets. Efficient filtering on facet fields (requires
__exactsuffix). - Spatial/Geo Search: Geographic location search, distance-based queries, and bounding box searches.
- More Like This: Similarity search to find related documents.
- Highlighting and Spelling Suggestions: Highlight search terms in results and provide automatic spelling correction.
- Complete Haystack Compatibility: Supports all standard Haystack features including field boosting, stored fields, and multiple connections.
Requirements
- Python 3.11 or later
- Django 5.2 or later
- OpenSearch 1.x through 3.x
- django-haystack 3.3.0 or later
Quick Start
1. Installation
Install the package using pip:
pip install django_haystack_opensearch
Or using uv:
uv add django_haystack_opensearch
2. Configuration
Add haystack to your INSTALLED_APPS in settings.py:
INSTALLED_APPS = [
# ...
"haystack",
]
Configure the Haystack connection:
HAYSTACK_CONNECTIONS = {
"default": {
"ENGINE": "django_haystack_opensearch.haystack.OpenSearchSearchEngine",
"URL": "http://localhost:9200",
"INDEX_NAME": "haystack",
},
}
3. Usage
Define your search indexes as usual. When filtering on facet fields, remember to use the __exact suffix:
from haystack.query import SearchQuerySet
# Filter by a facet field (requires __exact)
results = SearchQuerySet().filter(author__exact="John Doe")
Common Use Cases
- Adding Search to Django Applications: Quickly add powerful search functionality to any Django project.
- Migrating from Elasticsearch to OpenSearch: A drop-in replacement for existing Elasticsearch backends with no code changes required.
- Building Faceted Search Interfaces: Create complex filter interfaces with accurate facet counts.
Getting Help
- Check the Documentation for detailed guides and examples.
- Report bugs or request features on the GitHub Issues page.
- Explore the
sandbox/directory for a complete demonstration application.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_haystack_opensearch-1.0.0.tar.gz.
File metadata
- Download URL: django_haystack_opensearch-1.0.0.tar.gz
- Upload date:
- Size: 94.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
95815cf057da071d14a0cbac99dde98b5a1a1f39979a245bdab1833cd6253ff5
|
|
| MD5 |
ff62b277ac20ed3f86af0b36fea47122
|
|
| BLAKE2b-256 |
794e4eb17f072c492d2524166629e2af6e8beb18ebfd1c1f20b71c3c4dabf10d
|
File details
Details for the file django_haystack_opensearch-1.0.0-py3-none-any.whl.
File metadata
- Download URL: django_haystack_opensearch-1.0.0-py3-none-any.whl
- Upload date:
- Size: 103.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
942256a8d7a645494d520f6346350f489390fb49e2074e71c9602b1296dd17e3
|
|
| MD5 |
f36a38006187665fe767761e8ce5aa1e
|
|
| BLAKE2b-256 |
688712f74217b8f04e789a6f7dda2fa69ff77c9b2b78f088fb01ff84bef1cb83
|