-
Notifications
You must be signed in to change notification settings - Fork 25.3k
For the fields fetch phase, avoid reloading stored fields. #58196
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -101,7 +101,8 @@ public void execute(SearchContext context) { | |
if (!context.hasScriptFields() && !context.hasFetchSourceContext()) { | ||
context.fetchSourceContext(new FetchSourceContext(true)); | ||
} | ||
fieldsVisitor = new FieldsVisitor(context.sourceRequested()); | ||
boolean loadSource = context.sourceRequested() || context.fetchFieldsContext() != null; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we have the same logic in the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it'd be safest to add it below too. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oops, thanks for catching this. I'll push an update. |
||
fieldsVisitor = new FieldsVisitor(loadSource); | ||
} else if (storedFieldsContext.fetchFields() == false) { | ||
// disable stored fields entirely | ||
fieldsVisitor = null; | ||
|
@@ -130,7 +131,7 @@ public void execute(SearchContext context) { | |
} | ||
} | ||
} | ||
boolean loadSource = context.sourceRequested(); | ||
boolean loadSource = context.sourceRequested() || context.fetchFieldsContext() != null; | ||
if (storedToRequestedFields.isEmpty()) { | ||
// empty list specified, default to disable _source if no explicit indication | ||
fieldsVisitor = new FieldsVisitor(loadSource); | ||
|
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 tend to stick
refresh
on the index request.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.
👍 this is nicer, especially when there's only one index request.