django-haystack / django-haystack/django-haystack

ElasticSearch DocumentMissingException

Open
#955 1 comment 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

'm using django-haystack with elasticsearch.

I have a problem when i'm using the "more like this" functionality

here is what I doing:

--- from haystack.query import SearchQuerySet
--- from appl.models import Product
--- p = Product.objects.all()[0]
--- p
[Product: Windows 8]

--- p.pk
207

--- SearchQuerySet().models(Product).filter(django_id=207)
PUT /lang-en [status:400 request:0.110s]
[SearchResult: appl.product (pk='207')]

--- SearchQuerySet().models(Product).more_like_this(p)
[]
GET /lang-en/modelresult/appl.product.207/_mlt?mlt_fields=text&search_from=0&search_size=20 [status:404 request:0.102s]
Failed to fetch More Like This from Elasticsearch for document 'appl.product.207': TransportError(404, 'DocumentMissingException[[_na][_na] [modelresult][appl.product.207]: document missing]')

It says that document "appl.product.207" does not exists , but when I use a filter , it returns me the object

[SearchResult: appl.product (pk='207')]

maybe I'm doing something wrong?

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 SearchQuerySet().models(Product).more_like_this(p) and compare its Elasticsearch request with the preceding django_id filter. Reproduce the 404 for /modelresult/appl.product.207/_mlt and check why the document is visible to filtering but missing from More Like This. Done means the cause is identified and the reported More Like This behavior is corrected or clearly documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
elasticsearch, python
Domain
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.