Skip to content

Commit

Permalink
ESQL: Generate kibana inline docs (#106782)
Browse files Browse the repository at this point in the history
This takes a stab at generating the markdown files that Kibana uses for
its inline help. It doesn't include all of the examples because the
`@Example` annotation is not filled in - we're tracking that in
#104247 (comment)

There are some links in the output and they are in markdown syntax. We
should figure out how to make them work for kibana.
  • Loading branch information
nik9000 authored Apr 9, 2024
1 parent 8852566 commit 96227a1
Show file tree
Hide file tree
Showing 167 changed files with 9,196 additions and 69 deletions.
2 changes: 2 additions & 0 deletions docs/reference/esql/functions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ The files in these subdirectories are generated by ESQL's test suite:
* `signature` - railroad diagram of the syntax to invoke each function
* `types` - a table of each combination of support type for each parameter. These are generated from tests.
* `layout` - a fully generated description for each function
* `kibana/definition` - function definitions for kibana's ESQL editor
* `kibana/docs` - the inline docs for kibana

Most functions can use the generated docs generated in the `layout` directory.
If we need something more custom for the function we can make a file in this
Expand Down
60 changes: 60 additions & 0 deletions docs/reference/esql/functions/kibana/definition/abs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"comment" : "This is generated by ESQL's AbstractFunctionTestCase. Do no edit it. See ../README.md for how to regenerate it.",
"type" : "eval",
"name" : "abs",
"description" : "Returns the absolute value.",
"signatures" : [
{
"params" : [
{
"name" : "number",
"type" : "double",
"optional" : false,
"description" : "Numeric expression. If `null`, the function returns `null`."
}
],
"variadic" : false,
"returnType" : "double"
},
{
"params" : [
{
"name" : "number",
"type" : "integer",
"optional" : false,
"description" : "Numeric expression. If `null`, the function returns `null`."
}
],
"variadic" : false,
"returnType" : "integer"
},
{
"params" : [
{
"name" : "number",
"type" : "long",
"optional" : false,
"description" : "Numeric expression. If `null`, the function returns `null`."
}
],
"variadic" : false,
"returnType" : "long"
},
{
"params" : [
{
"name" : "number",
"type" : "unsigned_long",
"optional" : false,
"description" : "Numeric expression. If `null`, the function returns `null`."
}
],
"variadic" : false,
"returnType" : "unsigned_long"
}
],
"examples" : [
"ROW number = -1.0 \n| EVAL abs_number = ABS(number)",
"FROM employees\n| KEEP first_name, last_name, height\n| EVAL abs_height = ABS(0.0 - height)"
]
}
59 changes: 59 additions & 0 deletions docs/reference/esql/functions/kibana/definition/acos.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"comment" : "This is generated by ESQL's AbstractFunctionTestCase. Do no edit it. See ../README.md for how to regenerate it.",
"type" : "eval",
"name" : "acos",
"description" : "Returns the arccosine of `n` as an angle, expressed in radians.",
"signatures" : [
{
"params" : [
{
"name" : "number",
"type" : "double",
"optional" : false,
"description" : "Number between -1 and 1. If `null`, the function returns `null`."
}
],
"variadic" : false,
"returnType" : "double"
},
{
"params" : [
{
"name" : "number",
"type" : "integer",
"optional" : false,
"description" : "Number between -1 and 1. If `null`, the function returns `null`."
}
],
"variadic" : false,
"returnType" : "double"
},
{
"params" : [
{
"name" : "number",
"type" : "long",
"optional" : false,
"description" : "Number between -1 and 1. If `null`, the function returns `null`."
}
],
"variadic" : false,
"returnType" : "double"
},
{
"params" : [
{
"name" : "number",
"type" : "unsigned_long",
"optional" : false,
"description" : "Number between -1 and 1. If `null`, the function returns `null`."
}
],
"variadic" : false,
"returnType" : "double"
}
],
"examples" : [
"ROW a=.9\n| EVAL acos=ACOS(a)"
]
}
59 changes: 59 additions & 0 deletions docs/reference/esql/functions/kibana/definition/asin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"comment" : "This is generated by ESQL's AbstractFunctionTestCase. Do no edit it. See ../README.md for how to regenerate it.",
"type" : "eval",
"name" : "asin",
"description" : "Returns the arcsine of the input\nnumeric expression as an angle, expressed in radians.",
"signatures" : [
{
"params" : [
{
"name" : "number",
"type" : "double",
"optional" : false,
"description" : "Number between -1 and 1. If `null`, the function returns `null`."
}
],
"variadic" : false,
"returnType" : "double"
},
{
"params" : [
{
"name" : "number",
"type" : "integer",
"optional" : false,
"description" : "Number between -1 and 1. If `null`, the function returns `null`."
}
],
"variadic" : false,
"returnType" : "double"
},
{
"params" : [
{
"name" : "number",
"type" : "long",
"optional" : false,
"description" : "Number between -1 and 1. If `null`, the function returns `null`."
}
],
"variadic" : false,
"returnType" : "double"
},
{
"params" : [
{
"name" : "number",
"type" : "unsigned_long",
"optional" : false,
"description" : "Number between -1 and 1. If `null`, the function returns `null`."
}
],
"variadic" : false,
"returnType" : "double"
}
],
"examples" : [
"ROW a=.9\n| EVAL asin=ASIN(a)"
]
}
59 changes: 59 additions & 0 deletions docs/reference/esql/functions/kibana/definition/atan.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"comment" : "This is generated by ESQL's AbstractFunctionTestCase. Do no edit it. See ../README.md for how to regenerate it.",
"type" : "eval",
"name" : "atan",
"description" : "Returns the arctangent of the input\nnumeric expression as an angle, expressed in radians.",
"signatures" : [
{
"params" : [
{
"name" : "number",
"type" : "double",
"optional" : false,
"description" : "Numeric expression. If `null`, the function returns `null`."
}
],
"variadic" : false,
"returnType" : "double"
},
{
"params" : [
{
"name" : "number",
"type" : "integer",
"optional" : false,
"description" : "Numeric expression. If `null`, the function returns `null`."
}
],
"variadic" : false,
"returnType" : "double"
},
{
"params" : [
{
"name" : "number",
"type" : "long",
"optional" : false,
"description" : "Numeric expression. If `null`, the function returns `null`."
}
],
"variadic" : false,
"returnType" : "double"
},
{
"params" : [
{
"name" : "number",
"type" : "unsigned_long",
"optional" : false,
"description" : "Numeric expression. If `null`, the function returns `null`."
}
],
"variadic" : false,
"returnType" : "double"
}
],
"examples" : [
"ROW a=12.9\n| EVAL atan=ATAN(a)"
]
}
Loading

0 comments on commit 96227a1

Please sign in to comment.