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
Skip segment for MatchNoDocsQuery
filters
#98295
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) |
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 |
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
FilterByFilterAggregator
andFiltersAggregator
, as well as toTermsAggregator
when it usesStringTermsAggregatorFromFilters
internally; the latter is an adapter aggregator wrappingFilterByFilterAggregator
.Fixes #94637