-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Skip segment for MatchNoDocsQuery filters
#98295
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
Conversation
When a query of a filter gets rewritten to MatchNoDocsQuery, segments will not produce any results. We can therefore skip processing such segments. This applies to FilterByFilterAggregator and FiltersAggregator, as well as to TermsAggregator when it uses StringTermsAggregatorFromFilters internally; the latter is an adapter aggregator to FilterByFilterAggregator. Fixes elastic#94637
|
Hi @kkrik-es, I've created a changelog YAML for you. |
|
@elasticsearchmachine run elasticsearch-ci/part-2 |
|
Pinging @elastic/es-analytics-geo (Team:Analytics) |
martijnvg
left 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.
Looks good, left a question.
server/src/main/java/org/elasticsearch/search/aggregations/bucket/filter/FiltersAggregator.java
Outdated
Show resolved
Hide resolved
.../main/java/org/elasticsearch/search/aggregations/bucket/filter/FilterByFilterAggregator.java
Outdated
Show resolved
Hide resolved
|
@elasticsearchmachine run elasticsearch-ci/part-3 |
martijnvg
left 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
|
@elasticsearchmachine run elasticsearch-ci/part-3 |
|
The optimization doesn't apply when |
When a query of a filter gets rewritten to
MatchNoDocsQuery, segments will not produce any results. We can therefore skip processing such segments.This applies to
FilterByFilterAggregatorandFiltersAggregator, as well as toTermsAggregatorwhen it usesStringTermsAggregatorFromFiltersinternally; the latter is an adapter aggregator wrappingFilterByFilterAggregator.Fixes #94637