django-haystack / django-haystack/django-haystack
Add Support for "track_total_hits" to Accurately Track Total Hits Above 10K
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 3.7k
- Forks
- 1.3k
- Avg merge
- 3h 18m
- Merged PRs (30d)
- 3
Description
Issue:
Django Haystack currently does not support the track_total_hits parameter, leading to inaccurate hit counts when the total exceeds 10,000 (due to Elasticsearch's default limit).
Suggestion:
We can add an option in the Elasticsearch backend to enable track_total_hits, allowing users to get accurate total hit counts above 10,000.
if settings.TRACK_TOTAL_HITS:
search_kwargs["track_total_hits"] = "true"
This could be added within the search method of elasticsearch_backend.py, allowing users to enable accurate hit tracking.
Reference:
Elasticsearch: Track Total Hits
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in haystack/backends/elasticsearch_backend.py at the search method linked in the issue, then read the Elasticsearch Track Total Hits reference. Determine how the backend option should be exposed and verified; done means users can enable accurate total hit counts beyond 10,000.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- elasticsearch, python
- Domain
- backend, search
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100