1
0
Эх сурвалжийг харах

ESQL: Un-snapshot all 3 URL scalar functions. (#135272)

* ESQL: Un-snapshot all 3 URL scalar functions: url_encode, url_encode_component, and url_decode.
- Move the declaration to be alongside string functions in the registry.
- Remove the snapshot instruction in all 3 capabilities.
- Annotate with GA/9.2.0 and run unit tests so changes trickle down to md and json files.
- Include the functions in the docs
- Add Wikipedia reference to percent-encoding, which also includes information about RFC 3986 and its unreserved chars

Resolves https://github.com/elastic/elasticsearch/issues/134087
Mouhcine Aitounejjar 2 долоо хоног өмнө
parent
commit
87a108ff07
17 өөрчлөгдсөн 39 нэмэгдсэн , 33 устгасан
  1. 1 1
      docs/reference/query-languages/esql/_snippets/functions/description/url_encode.md
  2. 1 1
      docs/reference/query-languages/esql/_snippets/functions/description/url_encode_component.md
  3. 1 2
      docs/reference/query-languages/esql/_snippets/functions/layout/url_decode.md
  4. 1 2
      docs/reference/query-languages/esql/_snippets/functions/layout/url_encode.md
  5. 1 2
      docs/reference/query-languages/esql/_snippets/functions/layout/url_encode_component.md
  6. 3 0
      docs/reference/query-languages/esql/_snippets/lists/string-functions.md
  7. 9 0
      docs/reference/query-languages/esql/functions-operators/string-functions.md
  8. 2 2
      docs/reference/query-languages/esql/kibana/definition/functions/url_decode.json
  9. 2 2
      docs/reference/query-languages/esql/kibana/definition/functions/url_encode.json
  10. 2 2
      docs/reference/query-languages/esql/kibana/definition/functions/url_encode_component.json
  11. 1 1
      docs/reference/query-languages/esql/kibana/docs/functions/url_encode.md
  12. 1 1
      docs/reference/query-languages/esql/kibana/docs/functions/url_encode_component.md
  13. 3 3
      x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java
  14. 4 4
      x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/EsqlFunctionRegistry.java
  15. 1 2
      x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/convert/UrlDecode.java
  16. 3 4
      x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/convert/UrlEncode.java
  17. 3 4
      x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/convert/UrlEncodeComponent.java

+ 1 - 1
docs/reference/query-languages/esql/_snippets/functions/description/url_encode.md

@@ -2,5 +2,5 @@
 
 **Description**
 
-URL-encodes the input. All characters are percent-encoded except for alphanumerics, `.`, `-`, `_`, and `~`. Spaces are encoded as `+`.
+URL-encodes the input. All characters are [percent-encoded](https://en.wikipedia.org/wiki/Percent-encoding) except for alphanumerics, `.`, `-`, `_`, and `~`. Spaces are encoded as `+`.
 

+ 1 - 1
docs/reference/query-languages/esql/_snippets/functions/description/url_encode_component.md

@@ -2,5 +2,5 @@
 
 **Description**
 
-URL-encodes the input. All characters are percent-encoded except for alphanumerics, `.`, `-`, `_`, and `~`. Spaces are encoded as `%20`.
+URL-encodes the input. All characters are [percent-encoded](https://en.wikipedia.org/wiki/Percent-encoding) except for alphanumerics, `.`, `-`, `_`, and `~`. Spaces are encoded as `%20`.
 

+ 1 - 2
docs/reference/query-languages/esql/_snippets/functions/layout/url_decode.md

@@ -2,8 +2,7 @@
 
 ## `URL_DECODE` [esql-url_decode]
 ```{applies_to}
-stack: development
-serverless: preview
+stack: ga 9.2.0
 ```
 
 **Syntax**

+ 1 - 2
docs/reference/query-languages/esql/_snippets/functions/layout/url_encode.md

@@ -2,8 +2,7 @@
 
 ## `URL_ENCODE` [esql-url_encode]
 ```{applies_to}
-stack: development
-serverless: preview
+stack: ga 9.2.0
 ```
 
 **Syntax**

+ 1 - 2
docs/reference/query-languages/esql/_snippets/functions/layout/url_encode_component.md

@@ -2,8 +2,7 @@
 
 ## `URL_ENCODE_COMPONENT` [esql-url_encode_component]
 ```{applies_to}
-stack: development
-serverless: preview
+stack: ga 9.2.0
 ```
 
 **Syntax**

+ 3 - 0
docs/reference/query-languages/esql/_snippets/lists/string-functions.md

@@ -25,3 +25,6 @@
 * [`TO_LOWER`](../../functions-operators/string-functions.md#esql-to_lower)
 * [`TO_UPPER`](../../functions-operators/string-functions.md#esql-to_upper)
 * [`TRIM`](../../functions-operators/string-functions.md#esql-trim)
+* [`URL_ENCODE`](../../functions-operators/string-functions.md#esql-url_encode)
+* [`URL_ENCODE_COMPONENT`](../../functions-operators/string-functions.md#esql-url_encode_component)
+* [`URL_DECODE`](../../functions-operators/string-functions.md#esql-url_decode)

+ 9 - 0
docs/reference/query-languages/esql/functions-operators/string-functions.md

@@ -96,3 +96,12 @@ mapped_pages:
 :::{include} ../_snippets/functions/layout/trim.md
 :::
 
+:::{include} ../_snippets/functions/layout/url_encode.md
+:::
+
+:::{include} ../_snippets/functions/layout/url_encode_component.md
+:::
+
+:::{include} ../_snippets/functions/layout/url_decode.md
+:::
+

+ 2 - 2
docs/reference/query-languages/esql/kibana/definition/functions/url_decode.json

@@ -32,6 +32,6 @@
   "examples" : [
     "ROW u = \"https%3A%2F%2Fexample.com%2F%3Fx%3Dfoo%20bar%26y%3Dbaz\"\n| EVAL u = URL_DECODE(u)"
   ],
-  "preview" : true,
-  "snapshot_only" : true
+  "preview" : false,
+  "snapshot_only" : false
 }

+ 2 - 2
docs/reference/query-languages/esql/kibana/definition/functions/url_encode.json

@@ -32,6 +32,6 @@
   "examples" : [
     "ROW u = \"https://example.com/?x=foo bar&y=baz\" | EVAL u = URL_ENCODE(u)"
   ],
-  "preview" : true,
-  "snapshot_only" : true
+  "preview" : false,
+  "snapshot_only" : false
 }

+ 2 - 2
docs/reference/query-languages/esql/kibana/definition/functions/url_encode_component.json

@@ -32,6 +32,6 @@
   "examples" : [
     "ROW u = \"https://example.com/?x=foo bar&y=baz\"\n| EVAL u = URL_ENCODE_COMPONENT(u)"
   ],
-  "preview" : true,
-  "snapshot_only" : true
+  "preview" : false,
+  "snapshot_only" : false
 }

+ 1 - 1
docs/reference/query-languages/esql/kibana/docs/functions/url_encode.md

@@ -1,7 +1,7 @@
 % This is generated by ESQL's AbstractFunctionTestCase. Do not edit it. See ../README.md for how to regenerate it.
 
 ### URL ENCODE
-URL-encodes the input. All characters are percent-encoded except for alphanumerics, `.`, `-`, `_`, and `~`. Spaces are encoded as `+`.
+URL-encodes the input. All characters are [percent-encoded](https://en.wikipedia.org/wiki/Percent-encoding) except for alphanumerics, `.`, `-`, `_`, and `~`. Spaces are encoded as `+`.
 
 ```esql
 ROW u = "https://example.com/?x=foo bar&y=baz" | EVAL u = URL_ENCODE(u)

+ 1 - 1
docs/reference/query-languages/esql/kibana/docs/functions/url_encode_component.md

@@ -1,7 +1,7 @@
 % This is generated by ESQL's AbstractFunctionTestCase. Do not edit it. See ../README.md for how to regenerate it.
 
 ### URL ENCODE COMPONENT
-URL-encodes the input. All characters are percent-encoded except for alphanumerics, `.`, `-`, `_`, and `~`. Spaces are encoded as `%20`.
+URL-encodes the input. All characters are [percent-encoded](https://en.wikipedia.org/wiki/Percent-encoding) except for alphanumerics, `.`, `-`, `_`, and `~`. Spaces are encoded as `%20`.
 
 ```esql
 ROW u = "https://example.com/?x=foo bar&y=baz"

+ 3 - 3
x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java

@@ -1469,17 +1469,17 @@ public class EsqlCapabilities {
         /**
          * URL encoding function.
          */
-        URL_ENCODE(Build.current().isSnapshot()),
+        URL_ENCODE(),
 
         /**
          * URL component encoding function.
          */
-        URL_ENCODE_COMPONENT(Build.current().isSnapshot()),
+        URL_ENCODE_COMPONENT(),
 
         /**
          * URL decoding function.
          */
-        URL_DECODE(Build.current().isSnapshot()),
+        URL_DECODE(),
 
         /**
          * Allow lookup join on boolean expressions

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

@@ -414,7 +414,10 @@ public class EsqlFunctionRegistry {
                 def(Substring.class, Substring::new, "substring"),
                 def(ToLower.class, ToLower::new, "to_lower"),
                 def(ToUpper.class, ToUpper::new, "to_upper"),
-                def(Trim.class, Trim::new, "trim") },
+                def(Trim.class, Trim::new, "trim"),
+                def(UrlEncode.class, UrlEncode::new, "url_encode"),
+                def(UrlEncodeComponent.class, UrlEncodeComponent::new, "url_encode_component"),
+                def(UrlDecode.class, UrlDecode::new, "url_decode") },
             // date
             new FunctionDefinition[] {
                 def(DateDiff.class, DateDiff::new, "date_diff"),
@@ -544,9 +547,6 @@ public class EsqlFunctionRegistry {
                 def(L2Norm.class, L2Norm::new, "v_l2_norm"),
                 def(Magnitude.class, Magnitude::new, "v_magnitude"),
                 def(Hamming.class, Hamming::new, "v_hamming"),
-                def(UrlEncode.class, UrlEncode::new, "url_encode"),
-                def(UrlEncodeComponent.class, UrlEncodeComponent::new, "url_encode_component"),
-                def(UrlDecode.class, UrlDecode::new, "url_decode"),
                 def(TextEmbedding.class, bi(TextEmbedding::new), "text_embedding") } };
     }
 

+ 1 - 2
x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/convert/UrlDecode.java

@@ -43,10 +43,9 @@ public final class UrlDecode extends UnaryScalarFunction {
 
     @FunctionInfo(
         returnType = "keyword",
-        preview = true,
         description = "URL-decodes the input, or returns `null` and adds a warning header to the response if the input cannot be decoded.",
         examples = { @Example(file = "string", tag = "url_decode") },
-        appliesTo = { @FunctionAppliesTo(lifeCycle = FunctionAppliesToLifecycle.DEVELOPMENT) }
+        appliesTo = { @FunctionAppliesTo(lifeCycle = FunctionAppliesToLifecycle.GA, version = "9.2.0") }
     )
     public UrlDecode(
         Source source,

+ 3 - 4
x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/convert/UrlEncode.java

@@ -46,11 +46,10 @@ public final class UrlEncode extends UnaryScalarFunction {
 
     @FunctionInfo(
         returnType = "keyword",
-        preview = true,
-        description = "URL-encodes the input. All characters are percent-encoded except for alphanumerics, "
-            + "`.`, `-`, `_`, and `~`. Spaces are encoded as `+`.",
+        description = "URL-encodes the input. All characters are {wikipedia}/Percent-encoding[percent-encoded] except "
+            + "for alphanumerics, `.`, `-`, `_`, and `~`. Spaces are encoded as `+`.",
         examples = { @Example(file = "string", tag = "url_encode") },
-        appliesTo = { @FunctionAppliesTo(lifeCycle = FunctionAppliesToLifecycle.DEVELOPMENT) }
+        appliesTo = { @FunctionAppliesTo(lifeCycle = FunctionAppliesToLifecycle.GA, version = "9.2.0") }
     )
     public UrlEncode(
         Source source,

+ 3 - 4
x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/convert/UrlEncodeComponent.java

@@ -46,11 +46,10 @@ public class UrlEncodeComponent extends UnaryScalarFunction {
 
     @FunctionInfo(
         returnType = "keyword",
-        preview = true,
-        description = "URL-encodes the input. All characters are percent-encoded except for alphanumerics, "
-            + "`.`, `-`, `_`, and `~`. Spaces are encoded as `%20`.",
+        description = "URL-encodes the input. All characters are {wikipedia}/Percent-encoding[percent-encoded] except "
+            + "for alphanumerics, `.`, `-`, `_`, and `~`. Spaces are encoded as `%20`.",
         examples = { @Example(file = "string", tag = "url_encode_component") },
-        appliesTo = { @FunctionAppliesTo(lifeCycle = FunctionAppliesToLifecycle.DEVELOPMENT) }
+        appliesTo = { @FunctionAppliesTo(lifeCycle = FunctionAppliesToLifecycle.GA, version = "9.2.0") }
     )
     public UrlEncodeComponent(
         Source source,