diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/optimizer/rules/physical/local/EnableSpatialDistancePushdown.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/optimizer/rules/physical/local/EnableSpatialDistancePushdown.java index 9929a6fb0b7b7..fde07b7899528 100644 --- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/optimizer/rules/physical/local/EnableSpatialDistancePushdown.java +++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/optimizer/rules/physical/local/EnableSpatialDistancePushdown.java @@ -168,7 +168,7 @@ private PhysicalPlan rewriteBySplittingFilter(FilterExec filterExec, EvalExec ev private Map getPushableDistances(List aliases, SearchStats stats) { Map distances = new LinkedHashMap<>(); - Predicate isIndexed = (fa) -> stats.isIndexed(fa.fieldName()); + Predicate isIndexed = (fa) -> stats.isIndexed(fa.name()); aliases.forEach(alias -> { if (alias.child() instanceof StDistance distance && canPushSpatialFunctionToSource(distance, isIndexed)) { distances.put(alias.id(), distance); diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/optimizer/rules/physical/local/PushFiltersToSource.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/optimizer/rules/physical/local/PushFiltersToSource.java index aede110b272b1..7ebd3cee6af91 100644 --- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/optimizer/rules/physical/local/PushFiltersToSource.java +++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/optimizer/rules/physical/local/PushFiltersToSource.java @@ -79,7 +79,7 @@ private static PhysicalPlan planFilterExec(FilterExec filterExec, EsQueryExec qu List nonPushable = new ArrayList<>(); for (Expression exp : splitAnd(filterExec.condition())) { Predicate hasIdenticalDelegate = (fa) -> LucenePushDownUtils.hasIdenticalDelegate(fa, ctx.searchStats()); - Predicate isIndexed = (fa) -> ctx.searchStats().isIndexed(fa.fieldName()); + Predicate isIndexed = (fa) -> ctx.searchStats().isIndexed(fa.name()); (canPushToSource(exp, hasIdenticalDelegate, isIndexed) ? pushable : nonPushable).add(exp); } return rewrite(filterExec, queryExec, pushable, nonPushable, List.of()); @@ -96,7 +96,7 @@ private static PhysicalPlan planFilterExec( List nonPushable = new ArrayList<>(); for (Expression exp : splitAnd(filterExec.condition())) { Predicate hasIdenticalDelegate = (fa) -> LucenePushDownUtils.hasIdenticalDelegate(fa, ctx.searchStats()); - Predicate isIndexed = (fa) -> ctx.searchStats().isIndexed(fa.fieldName()); + Predicate isIndexed = (fa) -> ctx.searchStats().isIndexed(fa.name()); Expression resExp = exp.transformUp(ReferenceAttribute.class, r -> aliasReplacedBy.resolve(r, r)); (canPushToSource(resExp, hasIdenticalDelegate, isIndexed) ? pushable : nonPushable).add(exp); } diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/optimizer/rules/physical/local/PushTopNToSource.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/optimizer/rules/physical/local/PushTopNToSource.java index add34004f4613..54ab53c5204fd 100644 --- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/optimizer/rules/physical/local/PushTopNToSource.java +++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/optimizer/rules/physical/local/PushTopNToSource.java @@ -63,7 +63,7 @@ public class PushTopNToSource extends PhysicalOptimizerRules.ParameterizedOptimi @Override protected PhysicalPlan rule(TopNExec topNExec, LocalPhysicalOptimizerContext ctx) { Predicate hasIdenticalDelegate = (fa) -> LucenePushDownUtils.hasIdenticalDelegate(fa, ctx.searchStats()); - Predicate isIndexed = (fa) -> ctx.searchStats().isIndexed(fa.fieldName()); + Predicate isIndexed = (fa) -> ctx.searchStats().isIndexed(fa.name()); Pushable pushable = evaluatePushable(topNExec, hasIdenticalDelegate, isIndexed); return pushable.rewrite(topNExec); }