-
Notifications
You must be signed in to change notification settings - Fork 25.4k
Refactor SourceProvider creation to consistently use MappingLookup #128213
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
Conversation
This change updates the code to always create SourceProvider instances via MappingLookup, avoiding direct exposure to the underlying source format (synthetic or stored). It also aligns source filtering behavior between SourceProvider and SourceLoader, ensuring consistent application of filters. This change is needed to enable source filtering to occur earlier in the fetch phase, for example, when constructing a synthetic source.
Pinging @elastic/es-storage-engine (Team:StorageEngine) |
Hi @jimczi, I've created a changelog YAML for you. |
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.
Two minor comments, LGTM otherwise.
server/src/main/java/org/elasticsearch/search/lookup/SourceProvider.java
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/search/lookup/SourceProvider.java
Show resolved
Hide resolved
new SearchLookup( | ||
field -> null, | ||
(ft, lookup, fdt) -> null, | ||
SourceProvider.fromLookup(MappingLookup.EMPTY, null, SourceFieldMetrics.NOOP) |
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.
Nit: add a test-only factory:
SourceProvider getEmptySourceProvider() {
return SourceProvider.fromLookup(MappingLookup.EMPTY, null, SourceFieldMetrics.NOOP);
}
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.
And maybe another one using MapperService
.
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 thought about that but I like the fact that these tests are purposively using an empty mapping rather than a direct method. It's not really an empty source provider, just a source provider with an empty mapping and I don't want to encourage writing more tests with this pattern.
…lastic#128213) This change updates the code to always create SourceProvider instances via MappingLookup, avoiding direct exposure to the underlying source format (synthetic or stored). It also aligns source filtering behaviour between SourceProvider and SourceLoader, ensuring consistent application of filters. This change is needed to enable source filtering to occur earlier in the fetch phase, for example, when constructing a synthetic source.
…128213) (#128312) This change updates the code to always create SourceProvider instances via MappingLookup, avoiding direct exposure to the underlying source format (synthetic or stored). It also aligns source filtering behaviour between SourceProvider and SourceLoader, ensuring consistent application of filters. This change is needed to enable source filtering to occur earlier in the fetch phase, for example, when constructing a synthetic source.
This change updates the code to always create SourceProvider instances via MappingLookup, avoiding direct exposure to the underlying source format (synthetic or stored). It also aligns source filtering behavior between SourceProvider and SourceLoader, ensuring consistent application of filters.
This change is needed to enable source filtering to occur earlier in the fetch phase, for example, when constructing a synthetic source.