|
31 | 31 | import org.elasticsearch.xpack.esql.expression.function.aggregate.Count; |
32 | 32 | import org.elasticsearch.xpack.esql.expression.function.aggregate.Max; |
33 | 33 | import org.elasticsearch.xpack.esql.expression.function.aggregate.Min; |
| 34 | +import org.elasticsearch.xpack.esql.expression.function.fulltext.Match; |
34 | 35 | import org.elasticsearch.xpack.esql.index.EsIndex; |
35 | 36 | import org.elasticsearch.xpack.esql.index.IndexResolution; |
36 | 37 | import org.elasticsearch.xpack.esql.parser.ParsingException; |
@@ -2310,6 +2311,27 @@ public void testInvalidNamedParamsForIdentifierPatterns() { |
2310 | 2311 | ); |
2311 | 2312 | } |
2312 | 2313 |
|
| 2314 | + public void testFromEnrichAndMatchColonUsage() { |
| 2315 | + assumeTrue("Match operator is available just for snapshots", EsqlCapabilities.Cap.MATCH_OPERATOR_COLON.isEnabled()); |
| 2316 | + |
| 2317 | + LogicalPlan plan = analyze(""" |
| 2318 | + from *:test |
| 2319 | + | EVAL x = to_string(languages) |
| 2320 | + | ENRICH _any:languages ON x |
| 2321 | + | WHERE first_name: "Anna" |
| 2322 | + """, "mapping-default.json"); |
| 2323 | + var limit = as(plan, Limit.class); |
| 2324 | + var filter = as(limit.child(), Filter.class); |
| 2325 | + var match = as(filter.condition(), Match.class); |
| 2326 | + var enrich = as(filter.child(), Enrich.class); |
| 2327 | + assertEquals(enrich.mode(), Enrich.Mode.ANY); |
| 2328 | + assertEquals(enrich.policy().getMatchField(), "language_code"); |
| 2329 | + var eval = as(enrich.child(), Eval.class); |
| 2330 | + var esRelation = as(eval.child(), EsRelation.class); |
| 2331 | + assertEquals(esRelation.index().name(), "test"); |
| 2332 | + |
| 2333 | + } |
| 2334 | + |
2313 | 2335 | private void verifyUnsupported(String query, String errorMessage) { |
2314 | 2336 | verifyUnsupported(query, errorMessage, "mapping-multi-field-variation.json"); |
2315 | 2337 | } |
|
0 commit comments