Skip to content

Commit f67c607

Browse files
Implement postAnalysisPlanVerification
1 parent 33fba44 commit f67c607

File tree

1 file changed

+19
-2
lines changed
  • x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/fulltext

1 file changed

+19
-2
lines changed

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/fulltext/MultiMatch.java

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import org.elasticsearch.index.query.MatchQueryBuilder;
1515
import org.elasticsearch.index.query.QueryBuilder;
1616
import org.elasticsearch.xpack.esql.capabilities.PostAnalysisPlanVerificationAware;
17+
import org.elasticsearch.xpack.esql.common.Failure;
1718
import org.elasticsearch.xpack.esql.common.Failures;
1819
import org.elasticsearch.xpack.esql.core.InvalidArgumentException;
1920
import org.elasticsearch.xpack.esql.core.expression.EntryExpression;
@@ -466,7 +467,23 @@ public int hashCode() {
466467

467468
@Override
468469
public BiConsumer<LogicalPlan, Failures> postAnalysisPlanVerification() {
469-
// TODO
470-
return super.postAnalysisPlanVerification();
470+
return (plan, failures) -> {
471+
super.postAnalysisPlanVerification().accept(plan, failures);
472+
plan.forEachExpression(MultiMatch.class, mm -> {
473+
for (Expression field : fields) {
474+
if (Match.fieldAsFieldAttribute(field) == null) {
475+
failures.add(
476+
Failure.fail(
477+
field,
478+
"[{}] {} cannot operate on [{}], which is not a field from an index mapping",
479+
functionName(),
480+
functionType(),
481+
field.sourceText()
482+
)
483+
);
484+
}
485+
}
486+
});
487+
};
471488
}
472489
}

0 commit comments

Comments
 (0)