django-haystack / django-haystack/django-haystack

Problem unpickling object will do a hit on elastic search

Open
#1,012 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

needs review
Dominant language
Python
Stars
3.7k
Forks
1.3k
Avg merge
3h 18m
Merged PRs (30d)
3

Description

Hi

I am facing an issue, I am trying to cache the queryset in the cache. I can pickle it fine saved to cache with no issues. Now I try to shut down my elastic search and get the objects from the cache I get the following error

pickle.loads(pickled_object)
Failed to query Elasticsearch using '*:*': HTTPConnectionPool(host='127.0.0.1', port=9200): Max retries exceeded with url: /my_model/modelresult/_search (Caused by <class 'socket.error'>: [Errno 61] Connection refused)

My question is why is it trying to do a select all on unpicking ? Also if this isn't the right way how can I cache the query set. I was thinking cache this as json but then how do I feed that to Haystack search query instead of hitting elastic search

Thanks

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the pickle.loads(pickled_object) path and the cached Django queryset/Haystack search query described in the report; reproduce it with Elasticsearch stopped. Trace why unpickling requests ':' and define whether the fix is to avoid that query or document an alternate cache representation; done when the chosen behavior is verified without Elasticsearch.

Written by the indexing model from the issue text.

Assessment

Tech stack
django, elasticsearch, python
Domain
backend, search
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.