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
Fix NPE during search with source filtering if the source is disabled. #20093
Fix NPE during search with source filtering if the source is disabled. #20093
Conversation
Instead of throwing an NPE, a search response with source filtering will not contain the source if it is disabled in the mapping. Closes elastic#7758
I mean the code LGTM but I wonder if we can start adding a unittest instead of an integration test for this? |
…tchingIT. Removed SourceFetchingIT#testSourceDisabled (now covered via unit test FetchSourceSubPhaseTests#testSourceDisabled).
} | ||
} | ||
|
||
public void test() throws IOException { |
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.
Maybe rename this testBasicOperation
or something?
@s1monw added unit tests. reverted integration test for disabled source. |
Looks good to me. I left a few style comments if you are interested in them, otherwise I can test locally and merge. |
Renamed main unit test method. Use assertEquals and assertNull instead of assertThat (less code).
test this please |
Awesome. @s1monw's kicked off a CI build for this. |
@elasticmachine, test this please. |
@qwerty4030, tests passed last night so I've merged. Thanks for fixing this! |
…xclude and source is disabled in the mappings. Fixing meant ignoring the _source parameter in the request as no fields can be extracted from it. We should rather throw a clear exception to clearly point out that we cannot extract fields from _source. Note that this happens only when explicitly trying to extract fields from source. When source is disabled and no _source parameter is specified, no errors will be thrown and no source will be returned. Closes elastic#20408 Relates to elastic#20093
…and source is disabled in the mappings. Fixing meant ignoring the _source parameter in the request as no fields can be extracted from it. We should rather throw a clear exception to clearly point out that we cannot extract fields from _source. Note that this happens only when explicitly trying to extract fields from source. When source is disabled and no _source parameter is specified, no errors will be thrown and no source will be returned. Closes #20408 Relates to #20093
…and source is disabled in the mappings. Fixing meant ignoring the _source parameter in the request as no fields can be extracted from it. We should rather throw a clear exception to clearly point out that we cannot extract fields from _source. Note that this happens only when explicitly trying to extract fields from source. When source is disabled and no _source parameter is specified, no errors will be thrown and no source will be returned. Closes #20408 Relates to #20093
Fix NPE during search with source filtering if the source is disabled.
Instead of throwing an NPE, search response hits with source filtering will not contain the source if it is disabled in the mapping.
Tests pass:
gradle test
gradle core:integTest
Closes #7758