Runtime fields: pass down runtime field name as source filter when source mode is synthetic#133897
Merged
martijnvg merged 22 commits intoelastic:mainfrom Sep 4, 2025
Merged
Conversation
…thetic This avoids synthesizing fields that are not requested
martijnvg
commented
Sep 1, 2025
| } | ||
|
|
||
| /** Returns {@code true} if the script only parses a field from source */ | ||
| default boolean isParsedFromSource() { |
Member
Author
There was a problem hiding this comment.
Basically for runtime fields without a script:
"runtime": {
...
"agent.version": {
"type": "keyword"
},
...
}
Collaborator
|
Pinging @elastic/es-storage-engine (Team:StorageEngine) |
Collaborator
|
Pinging @elastic/es-search-foundations (Team:Search Foundations) |
Collaborator
|
Hi @martijnvg, I've created a changelog YAML for you. |
kkrik-es
reviewed
Sep 2, 2025
server/src/main/java/org/elasticsearch/search/lookup/SourceProvider.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Kostas Krikellas <131142368+kkrik-es@users.noreply.github.com>
kkrik-es
reviewed
Sep 3, 2025
| MapperService mapperService = createMapperService(mapping); | ||
| SearchExecutionContext c = createSearchExecutionContext(mapperService); | ||
| { | ||
| var fieldType = (AbstractScriptFieldType) c.getFieldType("field_source"); |
Contributor
There was a problem hiding this comment.
Not clear why one uses the optimized path vs the other, mind adding a comment?
kkrik-es
approved these changes
Sep 3, 2025
jordan-powers
approved these changes
Sep 3, 2025
Contributor
jordan-powers
left a comment
There was a problem hiding this comment.
LGTM 👍, thanks Martijn
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If runtime fields have no scripts, then use the runtime field name as source filter.
This avoids synthesizing fields that are not requested