Skip to content

Aggs: Let terms run in global ords mode no match #124782

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

Merged
merged 5 commits into from
Mar 21, 2025

Conversation

nik9000
Copy link
Member

@nik9000 nik9000 commented Mar 13, 2025

Allows the terms agg to run with global ords if the top level query matches no docs but the agg is configured to collect buckets with 0 docs. Collecting buckets with 0 docs is much faster in global ords mode.

Allows the `terms` agg to run with global ords if the top level query
matches no docs *but* the agg is configured to collect buckets with 0
docs.
@nik9000 nik9000 added :Analytics/Aggregations Aggregations auto-backport Automatically create backport pull requests when merged v9.0.0 v8.19.0 v9.1.0 labels Mar 13, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-analytical-engine (Team:Analytics)

@elasticsearchmachine elasticsearchmachine added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label Mar 13, 2025
@nik9000 nik9000 added the >bug label Mar 13, 2025
@elasticsearchmachine
Copy link
Collaborator

Hi @nik9000, I've created a changelog YAML for you.

if (valuesSource.hasOrdinals() == false) {
execution = ExecutionMode.MAP;
}
if (matchNoDocs(context, parent) && bucketCountThresholds.getMinDocCount() > 0) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this should not kick in if the user sends a hint. We can run this in Global Ordinals mode, even if it's expensive, and if the user is asking to do that, it might be for a good reason.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pushed a patch.

@nik9000 nik9000 requested a review from not-napoleon March 21, 2025 01:17
Copy link
Member

@not-napoleon not-napoleon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nik9000 nik9000 merged commit e897a14 into elastic:main Mar 21, 2025
17 checks passed
@nik9000
Copy link
Member Author

nik9000 commented Mar 21, 2025

Thanks @not-napoleon !

@elasticsearchmachine
Copy link
Collaborator

💚 Backport successful

Status Branch Result
9.0
8.x

nik9000 added a commit to nik9000/elasticsearch that referenced this pull request Mar 21, 2025
Allows the `terms` agg to run with global ords if the top level query
matches no docs *but* the agg is configured to collect buckets with 0
docs.
nik9000 added a commit to nik9000/elasticsearch that referenced this pull request Mar 21, 2025
Allows the `terms` agg to run with global ords if the top level query
matches no docs *but* the agg is configured to collect buckets with 0
docs.
smalyshev pushed a commit to smalyshev/elasticsearch that referenced this pull request Mar 21, 2025
Allows the `terms` agg to run with global ords if the top level query
matches no docs *but* the agg is configured to collect buckets with 0
docs.
elasticsearchmachine pushed a commit that referenced this pull request Mar 21, 2025
Allows the `terms` agg to run with global ords if the top level query
matches no docs *but* the agg is configured to collect buckets with 0
docs.
elasticsearchmachine pushed a commit that referenced this pull request Mar 21, 2025
Allows the `terms` agg to run with global ords if the top level query
matches no docs *but* the agg is configured to collect buckets with 0
docs.
omricohenn pushed a commit to omricohenn/elasticsearch that referenced this pull request Mar 28, 2025
Allows the `terms` agg to run with global ords if the top level query
matches no docs *but* the agg is configured to collect buckets with 0
docs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/Aggregations Aggregations auto-backport Automatically create backport pull requests when merged >bug Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) v8.19.0 v9.0.0 v9.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants