-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
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 |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
out of curiosity: was this change necessary?
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it would be nice, unless that cause too much extra work on your end.
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 opened #46584 to split this pr a bit.
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 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
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.
still LGTM thanks @jimczi
…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
SearchContext
with theQueryShardContext
when building aggregator factories.Aggregator factories are part of the
SearchContext
so they shouldn't require aSearchContext
to create them.The main changes here are the signatures ofAggregationBuilder#build
that now takes aQueryShardContext
andAggregatorFactory#createInternal
that passes theSearchContext
to build theAggregator
.Relates #46523