Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'Elasticsearch' object has no attribute 'mlt' #15

Open
westurner opened this issue Aug 1, 2016 · 4 comments
Open

'Elasticsearch' object has no attribute 'mlt' #15

westurner opened this issue Aug 1, 2016 · 4 comments

Comments

@westurner
Copy link

'Elasticsearch' object has no attribute 'mlt'

line 424

haystackbrowser/admin.py in view
            raw_mlt = SearchQuerySet().more_like_this(model_instance)[:5] 
@kezabelle
Copy link
Owner

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?

@westurner
Copy link
Author

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:
elastic/elasticsearch-py#310 (comment)

On Aug 1, 2016 5:37 AM, "Keryn Knight" notifications@github.com 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
#15 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AADGy13hiHvQjLn6vn7IJhj8xvf4eMskks5qbcxKgaJpZM4JZP8I
.

kezabelle added a commit that referenced this issue Oct 11, 2016
… but haystack's backend doesn't support that completely. I think.
@kezabelle
Copy link
Owner

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.

@westurner
Copy link
Author

Thanks!

On Monday, October 17, 2016, Keryn Knight notifications@github.com wrote:

Hi, in 871b99b
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
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
#15 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AADGy3CzO5tUhBtqCy0Wzpoej7WURgMLks5q0y05gaJpZM4JZP8I
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants