Skip to content

Conversation

@romseygeek
Copy link
Contributor

Backports the following commits to 8.9:

) The FetchPhase sets source and field providers on its SearchLookup instance to ensure that we only have to load stored fields once per document. However, these were being set after subprocessors were constructed, and the FetchFieldsPhase subprocessor pulls a reference to the SearchLookup at construction time. This meant that the FieldsFetcher was not using these providers, instead using the standard source and fields lookup, in effect meaning that fields access would load source and fields separately. This would mostly just be an issue with performance; however, the top hits aggregation calls the fetch phase multiple times, with the result that the second and subsequent buckets in a top hits aggregation would see the source lookup from the previous bucket when building their FetchFieldsPhase subprocessor. This commit moves the call to SearchExecutionContext#setLookupProviders() in FetchPhase#buildSearchHits() before the call to build fetch phase subprocessors, ensuring that the fetch fields phase sees the correct SearchLookup. Fixes elastic#96284
@romseygeek romseygeek added :Analytics/Aggregations Aggregations :Search/Search Search-related issues that do not fall into other categories >bug auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) backport Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) Team:Search Meta label for search team labels Jul 10, 2023
@elasticsearchmachine elasticsearchmachine merged commit c14fdf6 into elastic:8.9 Jul 10, 2023
@romseygeek romseygeek deleted the backport/8.9/pr-97460 branch July 10, 2023 11:45
@rjernst rjernst added v8.9.0 and removed v8.9.1 labels Jul 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Analytics/Aggregations Aggregations auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) backport >bug :Search/Search Search-related issues that do not fall into other categories Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) Team:Search Meta label for search team v8.9.0

3 participants