-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Upgrade search app to Elastic Search 5.4 #3373
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have the knowledge to judge the ES part, but it seems OK otherwise.
@@ -43,7 +43,7 @@ def get_version_compare_data(project, base_version=None): | |||
} | |||
if highest_version_obj: | |||
ret_val['url'] = highest_version_obj.get_absolute_url() | |||
ret_val['slug'] = highest_version_obj.slug, | |||
ret_val['slug'] = highest_version_obj.slug |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing this comma produces tests to fail... I had the same problem and I ended up writing
(highest_version_obj.slug, )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the test should be fixed. Its expecting a tuple but it should get the slug in sting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@safwanrahman agreed -- want to PR it to master, and I'll merge it in here?
readthedocs/settings/base.py
Outdated
@@ -116,6 +116,7 @@ def INSTALLED_APPS(self): # noqa | |||
if donate: | |||
apps.append('django_countries') | |||
apps.append('readthedocsext.donate') | |||
apps.append('readthedocsext.search') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this under if donate:
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fixed that here, actually: https://github.com/rtfd/readthedocs.org/pull/3356/files#diff-5973fe59a4d52278d55f884d145bd5d7R11 :) Waiting on it to get merged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merged #3356, this can be rebased
readthedocs/urls.py
Outdated
groups.append([ | ||
url(r'^sustainability/', include('readthedocsext.donate.urls')), | ||
]) | ||
groups.insert(0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this change?
Seems to be the same, anyway.
readthedocs/urls.py
Outdated
groups.insert(0, | ||
[url(r'^sustainability/', include('readthedocsext.donate.urls'))] | ||
) | ||
for num, _url in enumerate(rtd_urls): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question again. This is only if the donate app is installed, why? I don't find the relationship between donate app and search app.
Is it possible to upgrade latest 6.x? |
@safwanrahman that breaks a lot of what we do, specifically removing the ability to have multiple doctypes per index, so I want to keep things here until we have more time to do a full rewrite. This is an incremental step. |
'lang': {'type': 'string', 'index': 'not_analyzed'}, | ||
'tags': {'type': 'string', 'index': 'not_analyzed'}, | ||
'privacy': {'type': 'string', 'index': 'not_analyzed'}, | ||
'id': {'type': 'keyword'}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is not id
is integer
or long
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the new ES doesn't let these vary types, or something. I was getting an error, and it doesn't really need to be an ID, so we will just use it as a string like the others.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ericholscher Seems like they support it
https://www.elastic.co/guide/en/elasticsearch/reference/current/number.html
Without ID, what can be here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does seem strange that we're coercing to string here, but I'm not familiar enough with ES to say why token/string is better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not that it's better, it just doesn't work otherwise. I don't fully understand it either.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It throws this error: RequestError: TransportError(400, u'illegal_argument_exception', u'mapper [id] cannot be changed from type [long] to [keyword]')
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. I can't comment much on the ES implementation details, but it seems reasonable. The long
-> string
coercion does seem like something we want to avoid if possible, but not really sure of the answer there.
'lang': {'type': 'string', 'index': 'not_analyzed'}, | ||
'tags': {'type': 'string', 'index': 'not_analyzed'}, | ||
'privacy': {'type': 'string', 'index': 'not_analyzed'}, | ||
'id': {'type': 'keyword'}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does seem strange that we're coercing to string here, but I'm not familiar enough with ES to say why token/string is better.
I've rebased this on master here: https://github.com/italia/readthedocs.org/tree/upgrade-es-rebased It fails for me against ES 5.6.8 with the following:
|
I've done some more work here: https://github.com/italia/readthedocs.org/tree/upgrade-es-rebased Now we are indexing again, updated the search regarding filtering and faceting (now called aggs) to what ES 5 expects. Still broken:
|
Closing this, hoping to be replaced by #4183 which uses Elastic Search 6. |
This upgrades elastic search, and fixes indexing so that it works on 5.4.
Also integrates the new 5.4 search code in ext. I'm not 100% convinced this shouldn't live in the .org codebase, but just following existing convention of where the docsearch code was.
Test failures are unrelated to this change.