-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Runtime fields: pass down runtime field name as source filter when source mode is synthetic #133897
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
Runtime fields: pass down runtime field name as source filter when source mode is synthetic #133897
Conversation
…thetic This avoids synthesizing fields that are not requested
| } | ||
|
|
||
| /** Returns {@code true} if the script only parses a field from source */ | ||
| default boolean isParsedFromSource() { |
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.
Basically for runtime fields without a script:
"runtime": {
...
"agent.version": {
"type": "keyword"
},
...
}
|
Pinging @elastic/es-storage-engine (Team:StorageEngine) |
|
Pinging @elastic/es-search-foundations (Team:Search Foundations) |
|
Hi @martijnvg, I've created a changelog YAML for you. |
server/src/main/java/org/elasticsearch/search/lookup/SourceProvider.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Kostas Krikellas <[email protected]>
| MapperService mapperService = createMapperService(mapping); | ||
| SearchExecutionContext c = createSearchExecutionContext(mapperService); | ||
| { | ||
| var fieldType = (AbstractScriptFieldType) c.getFieldType("field_source"); |
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.
Not clear why one uses the optimized path vs the other, mind adding a comment?
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.
LGTM 👍, thanks Martijn
If runtime fields have no scripts, then use the runtime field name as source filter.
This avoids synthesizing fields that are not requested