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
Use analyzer set on the field #8943
Conversation
This change adds a systemd service configuration file, and adds systemd logic to installation and de-installation scripts. The upcoming Debian 8 "Jessie" release will use systemd. fixes elastic#8943 Signed-off-by: Thilo Fromm <github@thilo-fromm.de>
This change adds a systemd service configuration file, and adds systemd logic to installation and de-installation scripts. The upcoming Debian 8 "Jessie" release will use systemd. fixes elastic#8943 Signed-off-by: Thilo Fromm <github@thilo-fromm.de>
I don't think we should do this. |
Fair enough. If |
Re-opening, An example is a company that runs language analysis and would like to use all of the 33 language-specific analyzers that ES provides. Duplicating the entire type 33 times is not a good solution, neither is re-analyzing each field 32 additional times for a multi-field with each language. Using While |
I do not think because a feature is used by very few that it should be precluded from the possibility of removal. In this case, I think this feature is trappy. With your example, this would mean these 33 languages are indexed into the same field, but with different analyzers (ie the purpose of Having 33 types, one for each language, may seem like a lot, but this is an extreme edge case, and I don't see any problem with edge cases needing to do more work in configuration. However, I also think this can be accomplished by having different fields for each language, and selecting all these fields to query over like in the simple query parser's fields list. |
We removed the per document _analyzer on master, so this commit won't go there anymore. In 1.x, we still support it though, and we did add support for it to highlighting with #6267. Seems that the highlighting support was incomplete though given this other PR. As far as I understand we only support it when specified through a path in the mapping? @masaruh can you confirm? If we do support this in 1.x but it's buggy I think we should fix it by getting this in 1.x. @clintongormley thoughts? |
@javanna it seems like a small enough fix |
@javanna I should have put more descriptive comment... With this fix, it first look for analyzer set on the field. If not found, try |
.get(); | ||
assertHighlight(response, 0, "text", 0, 1, equalTo("Look at me, I'm eating <1>cars</1>.")); | ||
assertHighlight(response, 0, "field2", 0, 1, equalTo("Look at me, I'm eating <1>cars</1>.")); |
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.
are you sure that this test fails without your fix? Seems like it still use the analyzer path, which used to work before too. I think we should write a different test for _analyzer without path defined in the mapping?
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.
Yes, it fails.
Since field2 uses standard analyzer, cars
is analyzed as cars
. Without this fix, query string "cars" is analyzed by standard analyzer (set on the field) and field's value "Look at me, I'm eating cars." is analyzed by "language_analyzer" (specified by _analzyer
) during highlighting. The former becomes cars
and the latter becomes car
. So, highlight doesn't work.
Yes, this test is a bit confusing... but it may be because of it's nature. We see this issue when _analyzer
path is set AND analyzer is set on the field. But you are right. better to write separate test for it. Will push another commit.
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.
gotcha, thanks for explaining.
Thanks for the explanation @masaruh . I reviewed this and left one comment around testing. |
Make highlighter use analyzer set on the field. Highlight with PlainHighlighter doesn't work on a field with an analyzer specified when a document has document level analyzer specified by _analyzer. With this fix, it first look for analyzer set on the field. If not found, try _analyzer's path. If not found or _analyzer's path is null, try analyzer set on type level. Closes elastic#8757
@javanna thanks for the review. Made a separate test with comment. Hopefully, it's less confusing. |
LGTM thanks @masaruh |
Thanks @javanna. Pushed to 1.5 and 1.x branch. |
Make highlighter use analyzer set on the field.
Closes #8757