Skip to content

Commit 6c9d17d

Browse files
committed
Remove match predicates
1 parent 14f0156 commit 6c9d17d

File tree

3 files changed

+7
-19
lines changed

3 files changed

+7
-19
lines changed

x-pack/plugin/esql-core/src/main/java/org/elasticsearch/xpack/esql/core/planner/ExpressionTranslators.java

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import org.elasticsearch.xpack.esql.core.expression.Expression;
1212
import org.elasticsearch.xpack.esql.core.expression.FieldAttribute;
1313
import org.elasticsearch.xpack.esql.core.expression.MetadataAttribute;
14-
import org.elasticsearch.xpack.esql.core.expression.predicate.fulltext.MatchQueryPredicate;
1514
import org.elasticsearch.xpack.esql.core.expression.predicate.fulltext.MultiMatchQueryPredicate;
1615
import org.elasticsearch.xpack.esql.core.expression.predicate.fulltext.StringQueryPredicate;
1716
import org.elasticsearch.xpack.esql.core.expression.predicate.logical.And;
@@ -24,7 +23,6 @@
2423
import org.elasticsearch.xpack.esql.core.expression.predicate.regex.WildcardLike;
2524
import org.elasticsearch.xpack.esql.core.querydsl.query.BoolQuery;
2625
import org.elasticsearch.xpack.esql.core.querydsl.query.ExistsQuery;
27-
import org.elasticsearch.xpack.esql.core.querydsl.query.MatchQuery;
2826
import org.elasticsearch.xpack.esql.core.querydsl.query.MultiMatchQuery;
2927
import org.elasticsearch.xpack.esql.core.querydsl.query.NotQuery;
3028
import org.elasticsearch.xpack.esql.core.querydsl.query.Query;
@@ -87,18 +85,6 @@ public static Query doTranslate(StringQueryPredicate q, TranslatorHandler handle
8785
}
8886
}
8987

90-
public static class Matches extends ExpressionTranslator<MatchQueryPredicate> {
91-
92-
@Override
93-
protected Query asQuery(MatchQueryPredicate q, TranslatorHandler handler) {
94-
return doTranslate(q, handler);
95-
}
96-
97-
public static Query doTranslate(MatchQueryPredicate q, TranslatorHandler handler) {
98-
return new MatchQuery(q.source(), handler.nameOf(q.field()), q.query(), q.boost(), q.fuzziness());
99-
}
100-
}
101-
10288
public static class MultiMatches extends ExpressionTranslator<MultiMatchQueryPredicate> {
10389

10490
@Override

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/optimizer/rules/physical/local/PushFiltersToSource.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import org.elasticsearch.xpack.esql.core.expression.function.scalar.UnaryScalarFunction;
2020
import org.elasticsearch.xpack.esql.core.expression.predicate.Predicates;
2121
import org.elasticsearch.xpack.esql.core.expression.predicate.Range;
22-
import org.elasticsearch.xpack.esql.core.expression.predicate.fulltext.MatchQueryPredicate;
2322
import org.elasticsearch.xpack.esql.core.expression.predicate.fulltext.StringQueryPredicate;
2423
import org.elasticsearch.xpack.esql.core.expression.predicate.logical.BinaryLogic;
2524
import org.elasticsearch.xpack.esql.core.expression.predicate.logical.Not;
@@ -247,8 +246,6 @@ public static boolean canPushToSource(Expression exp, Predicate<FieldAttribute>
247246
return isAttributePushable(cidrMatch.ipField(), cidrMatch, hasIdenticalDelegate) && Expressions.foldable(cidrMatch.matches());
248247
} else if (exp instanceof SpatialRelatesFunction spatial) {
249248
return canPushSpatialFunctionToSource(spatial);
250-
} else if (exp instanceof MatchQueryPredicate mqp) {
251-
return mqp.field() instanceof FieldAttribute && DataType.isString(mqp.field().dataType());
252249
} else if (exp instanceof StringQueryPredicate) {
253250
return true;
254251
} else if (exp instanceof QueryString) {

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/planner/EsqlExpressionTranslators.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ public final class EsqlExpressionTranslators {
8787
new ExpressionTranslators.Nots(),
8888
new ExpressionTranslators.Likes(),
8989
new ExpressionTranslators.StringQueries(),
90-
new ExpressionTranslators.Matches(),
9190
new ExpressionTranslators.MultiMatches(),
9291
new MatchFunctionTranslator(),
9392
new QueryStringFunctionTranslator(),
@@ -530,7 +529,13 @@ private static RangeQuery translate(Range r, TranslatorHandler handler) {
530529
public static class MatchFunctionTranslator extends ExpressionTranslator<Match> {
531530
@Override
532531
protected Query asQuery(Match match, TranslatorHandler handler) {
533-
return new MatchQuery(match.source(), ((FieldAttribute) match.field()).name(), match.queryAsText(), Map.of());
532+
return new MatchQuery(
533+
match.source(),
534+
((FieldAttribute) match.field()).name(),
535+
match.queryAsText(),
536+
match.boost(),
537+
match.fuzziness()
538+
);
534539
}
535540
}
536541

0 commit comments

Comments
 (0)