Replace the SearchContext with QueryShardContext when building aggregator factories#46527
Conversation
…ator factories This commit replaces the `SearchContext` with the `QueryShardContext` when building aggregator factories. Aggregator factories are part of the `SearchContext` so they shouldn't require a `SearchContext` to create them. The main changes here are the signatures of `AggregationBuilder#build` that now takes a `QueryShardContext` and `AggregatorFactory#createInternal` that passes the `SearchContext` to build the `Aggregator`. Relates elastic#46523
|
Pinging @elastic/es-analytics-geo |
javanna
left a comment
There was a problem hiding this comment.
the idea makes sense to me, it is not trivial to follow all that happens in this PR due to its size. I trust you though :)
| final long absoluteStartMillis = System.currentTimeMillis(); | ||
| QueryShardContext context = | ||
| indexService.newQueryShardContext(0, indexReader, () -> absoluteStartMillis, null); | ||
| indexService.newQueryShardContext(0, searcher, () -> absoluteStartMillis, null); |
There was a problem hiding this comment.
out of curiosity: was this change necessary?
There was a problem hiding this comment.
For simplicity the QueryShardContext should expose an IndexSearcher that is configured with the correct similarity, cache, ... I can make this change in a different pr if you like ?
There was a problem hiding this comment.
it would be nice, unless that cause too much extra work on your end.
There was a problem hiding this comment.
I merged #46584 and incorporated the changes in this pr, can you take another look ?
|
run elasticsearch-ci/1 |
This change adds an IndexSearcher and the node's BigArrays in the QueryShardContext. It's a spin off of elastic#46527 as this change is required to allow aggregation builder to solely use the query shard context. Relates elastic#46523
…ator factories (#46527) This commit replaces the `SearchContext` with the `QueryShardContext` when building aggregator factories. Aggregator factories are part of the `SearchContext` so they shouldn't require a `SearchContext` to create them. The main changes here are the signatures of `AggregationBuilder#build` that now takes a `QueryShardContext` and `AggregatorFactory#createInternal` that passes the `SearchContext` to build the `Aggregator`. Relates #46523
This commit replaces the
SearchContextwith theQueryShardContextwhen building aggregator factories.Aggregator factories are part of the
SearchContextso they shouldn't require aSearchContextto create them.The main changes here are the signatures ofAggregationBuilder#buildthat now takes aQueryShardContextandAggregatorFactory#createInternalthat passes theSearchContextto build theAggregator.Relates #46523