'Elasticsearch' object has no attribute 'mlt'
'Elasticsearch' object has no attribute 'mlt'
line 424
haystackbrowser/admin.py in view
raw_mlt = SearchQuerySet().more_like_this(model_instance)[:5]
- "More like this not working" https://github.com/django-haystack/django-haystack/issues/1398
- "The mlt method had been removed" https://github.com/elastic/elasticsearch-py/issues/310
Hi Wes,
Thanks for trying the package, and reporting this issue. I see that the reporter of the problem against haystack itself has closed the issue as not existing in 2.5.0, but I can't see how that can be the case, given self.conn.mlt still seems to be referenced.
The simple solution from my POV would be to catch the raise AttributeError and leave the more_like_this variable as an empty tuple, which should hopefully at least let the page complete execution, where I presume now it just 500s, unless you have any better suggestions?
Hi Keryn,
NOP'ing out the 'more like this' features would work for now; but the functionality is useful.
The comments in the linked issues indicate that the new way to accomplish 'more like this' with elasticsearch is with a search query parameter which elasticsearch-dsl wraps: https://github.com/elastic/elasticsearch-py/issues/310#issuecomment-159749937
On Aug 1, 2016 5:37 AM, "Keryn Knight" [email protected] wrote:
Hi Wes, Thanks for trying the package, and reporting this issue. I see that the reporter of the problem against haystack itself has closed the issue as not existing in 2.5.0, but I can't see how that can be the case, given self.conn.mlt https://github.com/django-haystack/django-haystack/blob/master/haystack/backends/elasticsearch_backend.py#L563 still seems to be referenced. The simple solution from my POV would be to catch the raise AttributeError and leave the more_like_this variable as an empty tuple, which should hopefully at least let the page complete execution, where I presume now it just 500s, unless you have any better suggestions?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/kezabelle/django-haystackbrowser/issues/15#issuecomment-236546911, or mute the thread https://github.com/notifications/unsubscribe-auth/AADGy13hiHvQjLn6vn7IJhj8xvf4eMskks5qbcxKgaJpZM4JZP8I .
Hi, in 871b99b I wrapped the call to more_like_this in a try/except to handle the fact that the underlying method .mlt does not exist on elasticsearch-py > 2.0.
I realise this is not ideal, because as you say, it's useful functionality, but given haystack intends to implement a separate backend for ES2, and it's own tests currently specify < 2.0, it's probably the correct one, short of special-casing what is an ostensibly unsupported dependency.
I'd rather not handle specifics of the non-public API of haystack, because it makes haystackbrowser, such as it is, more likely to drift from how haystack is actually used by people, which reduces its relevance as a debugging assistant.
I've not cut a release for this (at least not yet), so if you need this, you ought to be able to checkout master and hopefully not get an exception anymore.
Again, thank you for reporting this to me.
Thanks!
On Monday, October 17, 2016, Keryn Knight [email protected] wrote:
Hi, in 871b99b https://github.com/kezabelle/django-haystackbrowser/commit/871b99b80a741eab86cae7c0227048c96d3fe25a I wrapped the call to more_like_this in a try/except to handle the fact that the underlying method .mlt does not exist on elasticsearch-py > 2.0. I realise this is not ideal, because as you say, it's useful functionality, but given haystack intends to implement a separate backend for ES2, and it's own tests currently specify https://github.com/django-haystack/django-haystack/blob/master/setup.py#L20 < 2.0, it's probably the correct one, short of special-casing what is an ostensibly unsupported dependency. I'd rather not handle specifics of the non-public API of haystack, because it makes haystackbrowser, such as it is, more likely to drift from how haystack is actually used by people, which reduces its relevance as a debugging assistant.
I've not cut a release for this (at least not yet), so if you need this, you ought to be able to checkout master and hopefully not get an exception anymore.
Again, thank you for reporting this to me.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/kezabelle/django-haystackbrowser/issues/15#issuecomment-254140418, or mute the thread https://github.com/notifications/unsubscribe-auth/AADGy3CzO5tUhBtqCy0Wzpoej7WURgMLks5q0y05gaJpZM4JZP8I .