Przeglądaj źródła

Register match_phrase as a function not a snapshot function (#129255)

* Register match_phrase as a function not a snapshot function

* Update usage
Kathleen DeRusso 4 miesięcy temu
rodzic
commit
17d463f6bf

+ 1 - 1
docs/reference/query-languages/esql/kibana/definition/functions/match_phrase.json

@@ -59,5 +59,5 @@
     "FROM books\n| WHERE MATCH_PHRASE(author, \"William Faulkner\")"
   ],
   "preview" : true,
-  "snapshot_only" : true
+  "snapshot_only" : false
 }

+ 2 - 2
x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/EsqlFunctionRegistry.java

@@ -466,7 +466,8 @@ public class EsqlFunctionRegistry {
                 def(Kql.class, uni(Kql::new), "kql"),
                 def(Match.class, tri(Match::new), "match"),
                 def(MultiMatch.class, MultiMatch::new, "multi_match"),
-                def(QueryString.class, bi(QueryString::new), "qstr") } };
+                def(QueryString.class, bi(QueryString::new), "qstr"),
+                def(MatchPhrase.class, tri(MatchPhrase::new), "match_phrase") } };
 
     }
 
@@ -486,7 +487,6 @@ public class EsqlFunctionRegistry {
                 def(LastOverTime.class, LastOverTime::withUnresolvedTimestamp, "last_over_time"),
                 def(FirstOverTime.class, FirstOverTime::withUnresolvedTimestamp, "first_over_time"),
                 def(Term.class, bi(Term::new), "term"),
-                def(MatchPhrase.class, tri(MatchPhrase::new), "match_phrase"),
                 def(Knn.class, tri(Knn::new), "knn") } };
     }
 

+ 2 - 2
x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/esql/60_usage.yml

@@ -130,7 +130,7 @@ setup:
   - match: {esql.functions.coalesce: $functions_coalesce}
   - gt: {esql.functions.categorize: $functions_categorize}
   # Testing for the entire function set isn't feasible, so we just check that we return the correct count as an approximation.
-  - length: {esql.functions: 157} # check the "sister" test below for a likely update to the same esql.functions length check
+  - length: {esql.functions: 156} # check the "sister" test below for a likely update to the same esql.functions length check
 
 ---
 "Basic ESQL usage output (telemetry) non-snapshot version":
@@ -228,7 +228,7 @@ setup:
   - gt: {esql.functions.to_long: $functions_to_long}
   - match: {esql.functions.coalesce: $functions_coalesce}
   - gt: {esql.functions.categorize: $functions_categorize}
-  - length: {esql.functions: 145} # check the "sister" test above for a likely update to the same esql.functions length check
+  - length: {esql.functions: 146} # check the "sister" test above for a likely update to the same esql.functions length check
 
 ---
 took: