Skip to content

Commit

Permalink
[ES|QL] Add/Modify annotations for operators for better doc generation (
Browse files Browse the repository at this point in the history
#108220)

* annotation for operators
  • Loading branch information
fang-xing-esql committed May 4, 2024
1 parent 47a18d2 commit 4daac77
Show file tree
Hide file tree
Showing 44 changed files with 431 additions and 273 deletions.
34 changes: 0 additions & 34 deletions docs/reference/esql/functions/cidr_match.asciidoc

This file was deleted.

5 changes: 5 additions & 0 deletions docs/reference/esql/functions/description/cidr_match.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// This is generated by ESQL's AbstractFunctionTestCase. Do no edit it. See ../README.md for how to regenerate it.

*Description*

Returns true if the provided IP is contained in one of the provided CIDR blocks.
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

*Description*

Returns a boolean that indicates whether a keyword string ends with another string
Returns a boolean that indicates whether a keyword string ends with another string.
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

*Description*

Returns a boolean that indicates whether a keyword string starts with another string
Returns a boolean that indicates whether a keyword string starts with another string.
34 changes: 0 additions & 34 deletions docs/reference/esql/functions/ends_with.asciidoc

This file was deleted.

13 changes: 13 additions & 0 deletions docs/reference/esql/functions/examples/cidr_match.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// This is generated by ESQL's AbstractFunctionTestCase. Do no edit it. See ../README.md for how to regenerate it.

*Example*

[source.merge.styled,esql]
----
include::{esql-specs}/ip.csv-spec[tag=cdirMatchMultipleArgs]
----
[%header.monospaced.styled,format=dsv,separator=|]
|===
include::{esql-specs}/ip.csv-spec[tag=cdirMatchMultipleArgs-result]
|===

13 changes: 13 additions & 0 deletions docs/reference/esql/functions/examples/ends_with.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// This is generated by ESQL's AbstractFunctionTestCase. Do no edit it. See ../README.md for how to regenerate it.

*Example*

[source.merge.styled,esql]
----
include::{esql-specs}/string.csv-spec[tag=endsWith]
----
[%header.monospaced.styled,format=dsv,separator=|]
|===
include::{esql-specs}/string.csv-spec[tag=endsWith-result]
|===

13 changes: 13 additions & 0 deletions docs/reference/esql/functions/examples/starts_with.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// This is generated by ESQL's AbstractFunctionTestCase. Do no edit it. See ../README.md for how to regenerate it.

*Example*

[source.merge.styled,esql]
----
include::{esql-specs}/docs.csv-spec[tag=startsWith]
----
[%header.monospaced.styled,format=dsv,separator=|]
|===
include::{esql-specs}/docs.csv-spec[tag=startsWith-result]
|===

47 changes: 47 additions & 0 deletions docs/reference/esql/functions/kibana/definition/cidr_match.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"comment" : "This is generated by ESQL's AbstractFunctionTestCase. Do no edit it. See ../README.md for how to regenerate it.",
"type" : "eval",
"name" : "cidr_match",
"description" : "Returns true if the provided IP is contained in one of the provided CIDR blocks.",
"signatures" : [
{
"params" : [
{
"name" : "ip",
"type" : "ip",
"optional" : false,
"description" : "IP address of type `ip` (both IPv4 and IPv6 are supported)."
},
{
"name" : "blockX",
"type" : "keyword",
"optional" : false,
"description" : "CIDR block to test the IP against."
}
],
"variadic" : true,
"returnType" : "boolean"
},
{
"params" : [
{
"name" : "ip",
"type" : "ip",
"optional" : false,
"description" : "IP address of type `ip` (both IPv4 and IPv6 are supported)."
},
{
"name" : "blockX",
"type" : "text",
"optional" : false,
"description" : "CIDR block to test the IP against."
}
],
"variadic" : true,
"returnType" : "boolean"
}
],
"examples" : [
"FROM hosts \n| WHERE CIDR_MATCH(ip1, \"127.0.0.2/32\", \"127.0.0.3/32\") \n| KEEP card, host, ip0, ip1"
]
}
13 changes: 8 additions & 5 deletions docs/reference/esql/functions/kibana/definition/ends_with.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@
"comment" : "This is generated by ESQL's AbstractFunctionTestCase. Do no edit it. See ../README.md for how to regenerate it.",
"type" : "eval",
"name" : "ends_with",
"description" : "Returns a boolean that indicates whether a keyword string ends with another string",
"description" : "Returns a boolean that indicates whether a keyword string ends with another string.",
"signatures" : [
{
"params" : [
{
"name" : "str",
"type" : "keyword",
"optional" : false,
"description" : ""
"description" : "String expression. If `null`, the function returns `null`."
},
{
"name" : "suffix",
"type" : "keyword",
"optional" : false,
"description" : ""
"description" : "String expression. If `null`, the function returns `null`."
}
],
"variadic" : false,
Expand All @@ -28,17 +28,20 @@
"name" : "str",
"type" : "text",
"optional" : false,
"description" : ""
"description" : "String expression. If `null`, the function returns `null`."
},
{
"name" : "suffix",
"type" : "text",
"optional" : false,
"description" : ""
"description" : "String expression. If `null`, the function returns `null`."
}
],
"variadic" : false,
"returnType" : "boolean"
}
],
"examples" : [
"FROM employees\n| KEEP last_name\n| EVAL ln_E = ENDS_WITH(last_name, \"d\")"
]
}
13 changes: 8 additions & 5 deletions docs/reference/esql/functions/kibana/definition/starts_with.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@
"comment" : "This is generated by ESQL's AbstractFunctionTestCase. Do no edit it. See ../README.md for how to regenerate it.",
"type" : "eval",
"name" : "starts_with",
"description" : "Returns a boolean that indicates whether a keyword string starts with another string",
"description" : "Returns a boolean that indicates whether a keyword string starts with another string.",
"signatures" : [
{
"params" : [
{
"name" : "str",
"type" : "keyword",
"optional" : false,
"description" : ""
"description" : "String expression. If `null`, the function returns `null`."
},
{
"name" : "prefix",
"type" : "keyword",
"optional" : false,
"description" : ""
"description" : "String expression. If `null`, the function returns `null`."
}
],
"variadic" : false,
Expand All @@ -28,17 +28,20 @@
"name" : "str",
"type" : "text",
"optional" : false,
"description" : ""
"description" : "String expression. If `null`, the function returns `null`."
},
{
"name" : "prefix",
"type" : "text",
"optional" : false,
"description" : ""
"description" : "String expression. If `null`, the function returns `null`."
}
],
"variadic" : false,
"returnType" : "boolean"
}
],
"examples" : [
"FROM employees\n| KEEP last_name\n| EVAL ln_S = STARTS_WITH(last_name, \"B\")"
]
}
12 changes: 12 additions & 0 deletions docs/reference/esql/functions/kibana/docs/cidr_match.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!--
This is generated by ESQL's AbstractFunctionTestCase. Do no edit it. See ../README.md for how to regenerate it.
-->

### CIDR_MATCH
Returns true if the provided IP is contained in one of the provided CIDR blocks.

```
FROM hosts
| WHERE CIDR_MATCH(ip1, "127.0.0.2/32", "127.0.0.3/32")
| KEEP card, host, ip0, ip1
```
7 changes: 6 additions & 1 deletion docs/reference/esql/functions/kibana/docs/ends_with.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,10 @@ This is generated by ESQL's AbstractFunctionTestCase. Do no edit it. See ../READ
-->

### ENDS_WITH
Returns a boolean that indicates whether a keyword string ends with another string
Returns a boolean that indicates whether a keyword string ends with another string.

```
FROM employees
| KEEP last_name
| EVAL ln_E = ENDS_WITH(last_name, "d")
```
7 changes: 6 additions & 1 deletion docs/reference/esql/functions/kibana/docs/starts_with.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,10 @@ This is generated by ESQL's AbstractFunctionTestCase. Do no edit it. See ../READ
-->

### STARTS_WITH
Returns a boolean that indicates whether a keyword string starts with another string
Returns a boolean that indicates whether a keyword string starts with another string.

```
FROM employees
| KEEP last_name
| EVAL ln_S = STARTS_WITH(last_name, "B")
```
15 changes: 15 additions & 0 deletions docs/reference/esql/functions/layout/cidr_match.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// This is generated by ESQL's AbstractFunctionTestCase. Do no edit it. See ../README.md for how to regenerate it.

[discrete]
[[esql-cidr_match]]
=== `CIDR_MATCH`

*Syntax*

[.text-center]
image::esql/functions/signature/cidr_match.svg[Embedded,opts=inline]

include::../parameters/cidr_match.asciidoc[]
include::../description/cidr_match.asciidoc[]
include::../types/cidr_match.asciidoc[]
include::../examples/cidr_match.asciidoc[]
1 change: 1 addition & 0 deletions docs/reference/esql/functions/layout/ends_with.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ image::esql/functions/signature/ends_with.svg[Embedded,opts=inline]
include::../parameters/ends_with.asciidoc[]
include::../description/ends_with.asciidoc[]
include::../types/ends_with.asciidoc[]
include::../examples/ends_with.asciidoc[]
1 change: 1 addition & 0 deletions docs/reference/esql/functions/layout/starts_with.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ image::esql/functions/signature/starts_with.svg[Embedded,opts=inline]
include::../parameters/starts_with.asciidoc[]
include::../description/starts_with.asciidoc[]
include::../types/starts_with.asciidoc[]
include::../examples/starts_with.asciidoc[]
4 changes: 3 additions & 1 deletion docs/reference/esql/functions/like.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ The following wildcard characters are supported:
* `*` matches zero or more characters.
* `?` matches one character.

include::./types/like.asciidoc[]

[source.merge.styled,esql]
----
include::{esql-specs}/docs.csv-spec[tag=like]
Expand All @@ -21,4 +23,4 @@ include::{esql-specs}/docs.csv-spec[tag=like]
|===
include::{esql-specs}/docs.csv-spec[tag=like-result]
|===
// end::body[]
// end::body[]
2 changes: 1 addition & 1 deletion docs/reference/esql/functions/operators.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ include::unary.asciidoc[]
include::logical.asciidoc[]
include::predicates.asciidoc[]
include::cast.asciidoc[]
include::cidr_match.asciidoc[]
include::layout/cidr_match.asciidoc[]
include::in.asciidoc[]
include::like.asciidoc[]
include::rlike.asciidoc[]
9 changes: 9 additions & 0 deletions docs/reference/esql/functions/parameters/cidr_match.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// This is generated by ESQL's AbstractFunctionTestCase. Do no edit it. See ../README.md for how to regenerate it.

*Parameters*

`ip`::
IP address of type `ip` (both IPv4 and IPv6 are supported).

`blockX`::
CIDR block to test the IP against.
4 changes: 2 additions & 2 deletions docs/reference/esql/functions/parameters/ends_with.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*Parameters*

`str`::

String expression. If `null`, the function returns `null`.

`suffix`::

String expression. If `null`, the function returns `null`.
4 changes: 2 additions & 2 deletions docs/reference/esql/functions/parameters/starts_with.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*Parameters*

`str`::

String expression. If `null`, the function returns `null`.

`prefix`::

String expression. If `null`, the function returns `null`.

0 comments on commit 4daac77

Please sign in to comment.