Class PushCountQueryAndTagsToSource
java.lang.Object
org.elasticsearch.xpack.esql.rule.Rule<AggregateExec,PhysicalPlan>
org.elasticsearch.xpack.esql.optimizer.PhysicalOptimizerRules.OptimizerRule<AggregateExec>
org.elasticsearch.xpack.esql.optimizer.rules.physical.local.PushCountQueryAndTagsToSource
public class PushCountQueryAndTagsToSource
extends PhysicalOptimizerRules.OptimizerRule<AggregateExec>
Pushes count aggregations on top of query and tags to source.
Will transform:
Aggregate (count(*) by x)
└── Eval (x = round_to)
└── Query [query + tags]
into:
Filter (count > 0) └── StatsQuery [count with query + tags]Where the filter is needed since the original Aggregate would not produce buckets with count = 0. If there's more than one query on the query builder, and both filters are on the same field, this rule will also attempt to merge them before pushing. This can happen due to an external ESFilter (i.e., outside the ES|QL query), or simply to a previously pushed down WHERE clause. If the queries cannot be merged, the rule will not be applied.
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class org.elasticsearch.xpack.esql.optimizer.PhysicalOptimizerRules.OptimizerRule
apply
-
Constructor Details
-
PushCountQueryAndTagsToSource
public PushCountQueryAndTagsToSource()
-
-
Method Details
-
rule
- Specified by:
rulein classPhysicalOptimizerRules.OptimizerRule<AggregateExec>
-