-
Notifications
You must be signed in to change notification settings - Fork 24.7k
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
Aggs and constant_keyword #94637
Comments
Pinging @elastic/es-analytics-geo (Team:Analytics) |
We should also have a look at |
Hello @nik9000 , can i take this issue as a first time contributor? |
Hi is this issue still open |
Can i take this up if its still open? |
This issue is fairly involved and has some weird interactions with other ongoing efforts in aggregations. We prefer to keep this assigned as is, hope to make progress in the coming weeks. |
@kkrik-es please remove the good first issue tag then. |
A single setup with one table containing a
I wonder if the synthetic source or the use of timestamp filtering over many indexes contribute to the root cause. |
I think that behaviour might be a result of this change #96161. It is not clear to me if you are trying to test this avoiding the rewrite. In case you would like to skip rewriting the query to test the behaviour without rewriting, you can act on the pre-filter shard size. See SearchRequest::setPreFilterShardSize. Basically by setting a pre-filter shard size that is large enough you will skip rewriting of the query. |
After further discussion with the team, this is actually a legit repro: the filter is converted to a MatchNone but we still process every doc. We need to investigate if we can either move the filter into the query, or just skip doc processing in there's no possible match. |
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
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 wrapping `FilterByFilterAggregator`. Fixes #94637
I think the terms agg part hasn't been implemented yet of this issue? |
I checked simple term aggregations on Do we have a good use case here, where the terms aggregation can be further improved? |
Closing for now, we can reopen if we have good use cases to cover. |
* Skip segment for MatchNoDocsQuery filters. 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 #94637 * Update docs/changelog/98295.yaml * Check all filters for `MatchNoDocsQuery`. * Skip optimization when 'other' bucket is requested. * Revert "Set default index mode for TimeSeries to `null` (#98586)" This reverts commit 56abb86.
* Skip segment for MatchNoDocsQuery filters. 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 * Update docs/changelog/98295.yaml * Check all filters for `MatchNoDocsQuery`. * Skip optimization when 'other' bucket is requested. * Revert "Set default index mode for TimeSeries to `null` (elastic#98586)" This reverts commit 56abb86.
* Skip segment for MatchNoDocsQuery filters. 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 #94637 * Update docs/changelog/98295.yaml * Check all filters for `MatchNoDocsQuery`. * Skip optimization when 'other' bucket is requested. * Revert "Set default index mode for TimeSeries to `null` (#98586)" This reverts commit 56abb86.
* Skip segment for MatchNoDocsQuery filters. 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 #94637 * Update docs/changelog/98295.yaml * Check all filters for `MatchNoDocsQuery`. * Skip optimization when 'other' bucket is requested. * Revert "Set default index mode for TimeSeries to `null` (#98586)" This reverts commit 56abb86. * Revert "Rollback of #98586 (#98805)" This reverts commit e370194. * Skip updating source when missing synthetic mode * Update docs/changelog/98808.yaml * Skip matching assert in MapperService too * Refine the assert * Extend versions before 8.6, when TS had no synthetic source * Add source field mapping for non-synthetic TSDB * Delete 98586.yaml Duplicate changelog * Add comment to TSDB_NO_SYNTHETIC mapping * Spotless fix * Add yaml test * Fix version skip in yaml test
* Skip segment for MatchNoDocsQuery filters. 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 * Update docs/changelog/98295.yaml * Check all filters for `MatchNoDocsQuery`. * Skip optimization when 'other' bucket is requested. * Revert "Set default index mode for TimeSeries to `null` (elastic#98586)" This reverts commit 56abb86. * Revert "Rollback of elastic#98586 (elastic#98805)" This reverts commit e370194. * Skip updating source when missing synthetic mode * Update docs/changelog/98808.yaml * Skip matching assert in MapperService too * Refine the assert * Extend versions before 8.6, when TS had no synthetic source * Add source field mapping for non-synthetic TSDB * Delete 98586.yaml Duplicate changelog * Add comment to TSDB_NO_SYNTHETIC mapping * Spotless fix * Add yaml test * Fix version skip in yaml test
* Skip segment for MatchNoDocsQuery filters. 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 #94637 * Update docs/changelog/98295.yaml * Check all filters for `MatchNoDocsQuery`. * Skip optimization when 'other' bucket is requested. * Revert "Set default index mode for TimeSeries to `null` (#98586)" This reverts commit 56abb86. * Revert "Rollback of #98586 (#98805)" This reverts commit e370194. * Skip updating source when missing synthetic mode * Update docs/changelog/98808.yaml * Skip matching assert in MapperService too * Refine the assert * Extend versions before 8.6, when TS had no synthetic source * Add source field mapping for non-synthetic TSDB * Delete 98586.yaml Duplicate changelog * Add comment to TSDB_NO_SYNTHETIC mapping * Spotless fix * Add yaml test * Fix version skip in yaml test
* Skip segment for MatchNoDocsQuery filters. 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 * Update docs/changelog/98295.yaml * Check all filters for `MatchNoDocsQuery`. * Skip optimization when 'other' bucket is requested. * Revert "Set default index mode for TimeSeries to `null` (elastic#98586)" This reverts commit 56abb86. * Revert "Rollback of elastic#98586 (elastic#98805)" This reverts commit e370194. * Skip updating source when missing synthetic mode * Update docs/changelog/98808.yaml * Skip matching assert in MapperService too * Refine the assert * Extend versions before 8.6, when TS had no synthetic source * Add source field mapping for non-synthetic TSDB * Delete 98586.yaml Duplicate changelog * Add comment to TSDB_NO_SYNTHETIC mapping * Spotless fix * Add yaml test * Fix version skip in yaml test
Description
It'd be lovely is a
filters
orfilter
agg that touches aconstant_keyword
would properly rewrite itself tomatch_all
andmatch_none
and "go fast", at least when it's at the root of the aggs tree. Theoretically it should "just work" but it doesn't seem to. Also! Theterms
agg should be able to act on there being only a single possible value. Maybe it can even act on thematch_all
/match_none
nature of theconstant_keyword
. I'm not sure how, but it does feel like there are optimizations in there. Particularly whenterms
is the top level agg.The text was updated successfully, but these errors were encountered: