From 4c3f4048eab985979516f313c1004ff0b52110eb Mon Sep 17 00:00:00 2001 From: Corey Robertson Date: Thu, 10 Feb 2022 10:09:21 -0500 Subject: [PATCH] Update canvas function docs to match in app and vice versa --- .../canvas/canvas-function-reference.asciidoc | 503 ++++++++++-------- .../common/expression_functions/specs/clog.ts | 2 +- .../expression_functions/specs/math_column.ts | 9 +- .../i18n/functions/dict/alter_column.ts | 3 +- .../i18n/functions/dict/static_column.ts | 3 +- .../function_examples.ts | 31 ++ .../generate_function_reference.ts | 22 +- 7 files changed, 339 insertions(+), 234 deletions(-) diff --git a/docs/canvas/canvas-function-reference.asciidoc b/docs/canvas/canvas-function-reference.asciidoc index 24a7608f98fa71..efc82bbe71f77c 100644 --- a/docs/canvas/canvas-function-reference.asciidoc +++ b/docs/canvas/canvas-function-reference.asciidoc @@ -13,7 +13,7 @@ A *** denotes a required argument. A † denotes an argument can be passed multiple times. -<> | B | <> | <> | <> | <> | <> | <> | <> | <> | K | <> | <> | <> | O | <> | Q | <> | <> | <> | <> | <> | W | X | Y | Z +<> | B | <> | <> | <> | <> | <> | <> | <> | <> | <> | <> | <> | <> | O | <> | Q | <> | <> | <> | <> | <> | W | X | Y | Z [float] [[a_fns]] @@ -35,7 +35,8 @@ all condition={gt 10} condition={lt 20} *Code example* [source,text] ---- -filters +kibana +| selectFilter | demodata | math "mean(percent_uptime)" | formatnumber "0.0%" @@ -83,7 +84,8 @@ alterColumn column="@timestamp" name="foo" *Code example* [source,text] ---- -filters +kibana +| selectFilter | demodata | alterColumn "time" name="time_in_ms" type="number" | table @@ -131,7 +133,8 @@ any condition={lte 10} condition={gt 30} *Code example* [source,text] ---- -filters +kibana +| selectFilter | demodata | filterrows { getCell "project" | any {eq "elasticsearch"} {eq "kibana"} {eq "x-pack"} @@ -175,7 +178,8 @@ as name="bar" *Code example* [source,text] ---- -filters +kibana +| selectFilter | demodata | ply by="project" fn={math "count(username)" | as "num_users"} fn={math "mean(price)" | as "price"} | pointseries x="project" y="num_users" size="price" color="project" @@ -257,7 +261,8 @@ axisConfig position="right" min=0 max=10 tickSize=1 *Code example* [source,text] ---- -filters +kibana +| selectFilter | demodata | pointseries x="size(cost)" y="project" color="project" | plot defaultStyle={seriesStyle bars=0.75 horizontalBars=true} @@ -380,7 +385,7 @@ Clears the _context_, and returns `null`. [[clog_fn]] === `clog` -It outputs the _context_ in the console. This function is for debug purpose. +Outputs the _input_ in the console. This function is for debug purposes *Expression syntax* [source,js] @@ -391,74 +396,20 @@ clog *Code example* [source,text] ---- -filters - | demodata - | clog - | filterrows fn={getCell "age" | gt 70} - | clog - | pointseries x="time" y="mean(price)" - | plot defaultStyle={seriesStyle lines=1 fill=1} - | render +kibana +| demodata +| clog +| filterrows fn={getCell "age" | gt 70} +| clog +| pointseries x="time" y="mean(price)" +| plot defaultStyle={seriesStyle lines=1 fill=1} +| render ---- This prints the `datatable` objects in the browser console before and after the `filterrows` function. *Accepts:* `any` -*Returns:* `any` - -[float] -[[createTable_fn]] -=== `createTable` - -Creates a datatable with a list of columns, and 1 or more empty rows. -To populate the rows, use <> or <>. - -[cols="3*^<"] -|=== -|Argument |Type |Description - -|ids *** † - -|`string` -|Column ids to generate in positional order. ID represents the key in the row. - -|`names` † -|`string` -|Column names to generate in positional order. Names are not required to be unique, and default to the ID if not provided. - -|`rowCount` - -Default: 1 -|`number` -|The number of empty rows to add to the table, to be assigned a value later. -|=== - -*Expression syntax* -[source,js] ----- -createTable id="a" id="b" -createTable id="a" name="A" id="b" name="B" rowCount=5 ----- - -*Code example* -[source,text] ----- -var_set - name="logs" value={essql "select count(*) as a from kibana_sample_data_logs"} - name="commerce" value={essql "select count(*) as b from kibana_sample_data_ecommerce"} -| createTable ids="totalA" ids="totalB" -| staticColumn name="totalA" value={var "logs" | getCell "a"} -| alterColumn column="totalA" type="number" -| staticColumn name="totalB" value={var "commerce" | getCell "b"} -| alterColumn column="totalB" type="number" -| mathColumn id="percent" name="percent" expression="totalA / totalB" -| render ----- - -This creates a table based on the results of two `essql` queries, joined -into one table. - -*Accepts:* `null` +*Returns:* Depends on your input and arguments [float] @@ -477,7 +428,8 @@ columns exclude="username, country, age" *Code example* [source,text] ---- -filters +kibana +| selectFilter | demodata | columns include="price, cost, state, project" | table @@ -521,7 +473,8 @@ compare op="lte" to=100 *Code example* [source,text] ---- -filters +kibana +| selectFilter | demodata | mapColumn project fn={getCell project | @@ -673,6 +626,59 @@ Using the `context` function allows us to pass the output, or _context_, of the *Returns:* Depends on your input and arguments +[float] +[[createTable_fn]] +=== `createTable` + +Creates a datatable with a list of columns, and 1 or more empty rows. To populate the rows, use <> or <>. + +*Expression syntax* +[source,js] +---- +createTable id="a" id="b" +createTable id="a" name="A" id="b" name="B" rowCount=5 +---- + +*Code example* +[source,text] +---- +var_set +name="logs" value={essql "select count(*) as a from kibana_sample_data_logs"} +name="commerce" value={essql "select count(*) as b from kibana_sample_data_ecommerce"} +| createTable ids="totalA" ids="totalB" +| staticColumn name="totalA" value={var "logs" | getCell "a"} +| alterColumn column="totalA" type="number" +| staticColumn name="totalB" value={var "commerce" | getCell "b"} +| alterColumn column="totalB" type="number" +| mathColumn id="percent" name="percent" expression="totalA / totalB" +| render +---- +This creates a table based on the results of two `essql` queries, joined into one table. + +*Accepts:* `null` + +[cols="3*^<"] +|=== +|Argument |Type |Description + +|`ids` † +|`string` +|Column ids to generate in positional order. ID represents the key in the row. + +|`names` † +|`string` +|Column names to generate in positional order. Names are not required to be unique, and default to the ID if not provided. + +|`rowCount` +|`number` +|The number of empty rows to add to the table, to be assigned a value later + +Default: `1` +|=== + +*Returns:* `datatable` + + [float] [[csv_fn]] === `csv` @@ -793,7 +799,8 @@ demodata type="shirts" *Code example* [source,text] ---- -filters +kibana +| selectFilter | demodata | table | render @@ -876,6 +883,10 @@ This creates a dropdown filter element. It requires a data source and uses the u |`string` |The group name for the filter. +|`labelColumn` +|`string` +|The column or field to use as the label in the dropdown control + |`valueColumn` *** |`string` |The column or field from which to extract the unique values for the dropdown control. @@ -887,6 +898,32 @@ This creates a dropdown filter element. It requires a data source and uses the u [[e_fns]] == E +[float] +[[embeddable_fn]] +=== `embeddable` + +Returns an embeddable with the provided configuration + +*Accepts:* `filter` + +[cols="3*^<"] +|=== +|Argument |Type |Description + +|_Unnamed_ *** + +Alias: `config` +|`string` +|The base64 encoded embeddable input object + +|`type` *** +|`string` +|The embeddable type +|=== + +*Returns:* `embeddable` + + [float] [[eq_fn]] === `eq` @@ -905,7 +942,8 @@ eq "foo" *Code example* [source,text] ---- -filters +kibana +| selectFilter | demodata | mapColumn project fn={getCell project | @@ -953,7 +991,8 @@ escount query="response:404" index="kibana_sample_data_logs" *Code example* [source,text] ---- -filters +kibana +| selectFilter | escount "Cancelled:true" index="kibana_sample_data_flights" | math "value" | progress shape="semicircle" @@ -980,7 +1019,7 @@ Default: `"-_index:.kibana"` |`index` |`string` -|An index or {data-source}. For example, `"logstash-*"`. +|An index or data view. For example, `"logstash-*"`. Default: `"_all"` |=== @@ -1007,7 +1046,8 @@ esdocs index="kibana_sample_data_flights" sort="AvgTicketPrice, asc" *Code example* [source,text] ---- -filters +kibana +| selectFilter | esdocs index="kibana_sample_data_ecommerce" fields="customer_gender, taxful_total_price, order_date" sort="order_date, asc" @@ -1020,7 +1060,7 @@ filters palette={palette "#7ECAE3" "#003A4D" gradient=true} | render ---- -This retrieves the first 10000 documents data from the `kibana_sample_data_ecommerce` {data-source} sorted by `order_date` in ascending order, and only requests the `customer_gender`, `taxful_total_price`, and `order_date` fields. +This retrieves the first 10000 documents data from the `kibana_sample_data_ecommerce` index sorted by `order_date` in ascending order, and only requests the `customer_gender`, `taxful_total_price`, and `order_date` fields. *Accepts:* `filter` @@ -1048,7 +1088,7 @@ Default: `1000` |`index` |`string` -|An index or {data-source}. For example, `"logstash-*"`. +|An index or data view. For example, `"logstash-*"`. Default: `"_all"` @@ -1080,7 +1120,8 @@ essql "SELECT * FROM "apm*"" count=10000 *Code example* [source,text] ---- -filters +kibana +| selectFilter | essql query="SELECT Carrier, FlightDelayMin, AvgTicketPrice FROM "kibana_sample_data_flights"" | table | render @@ -1105,6 +1146,12 @@ Aliases: `q`, `query` Default: `1000` +|`parameter` † + +Alias: `param` +|`string`, `number`, `boolean` +|A parameter to be passed to the SQL query. + |`timezone` Alias: `tz` @@ -1134,7 +1181,8 @@ exactly column="project" value="beats" *Code example* [source,text] ---- -filters +kibana +| selectFilter | exactly column=project value=elasticsearch | demodata | pointseries x=project y="mean(age)" @@ -1188,7 +1236,8 @@ filterrows fn={getCell "age" | gt 50} *Code example* [source,text] ---- -filters +kibana +| selectFilter | demodata | filterrows {getCell "country" | any {eq "IN"} {eq "US"} {eq "CN"}} | mapColumn "@timestamp" @@ -1297,7 +1346,8 @@ font lHeight=32 *Code example* [source,text] ---- -filters +kibana +| selectFilter | demodata | pointseries x="project" y="size(cost)" color="project" | plot defaultStyle={seriesStyle bars=0.75} legend=false @@ -1323,23 +1373,25 @@ filters |`string` |The horizontal text alignment. -Default: `"left"` +Default: `${ theme "font.align" default="left" }` |`color` |`string` |The text color. +Default: `${ theme "font.color" }` + |`family` |`string` |An acceptable CSS web font string -Default: `"'Open Sans', Helvetica, Arial, sans-serif"` +Default: `${ theme "font.family" default="'Open Sans', Helvetica, Arial, sans-serif" }` |`italic` |`boolean` |Italicize the text? -Default: `false` +Default: `${ theme "font.italic" default=false }` |`lHeight` @@ -1347,25 +1399,31 @@ Alias: `lineHeight` |`number`, `null` |The line height in pixels -Default: `null` +Default: `${ theme "font.lHeight" }` |`size` |`number` -|The font size in pixels +|The font size + +Default: `${ theme "font.size" default=14 }` -Default: `14` +|`sizeUnit` +|`string` +|The font size unit + +Default: `"px"` |`underline` |`boolean` |Underline the text? -Default: `false` +Default: `${ theme "font.underline" default=false }` |`weight` |`string` |The font weight. For example, `"normal"`, `"bold"`, `"bolder"`, `"lighter"`, `"100"`, `"200"`, `"300"`, `"400"`, `"500"`, `"600"`, `"700"`, `"800"`, or `"900"`. -Default: `"normal"` +Default: `${ theme "font.weight" default="normal" }` |=== *Returns:* `style` @@ -1387,7 +1445,8 @@ formatdate "MM/DD/YYYY" *Code example* [source,text] ---- -filters +kibana +| selectFilter | demodata | mapColumn "time" fn={getCell time | formatdate "MMM 'YY"} | pointseries x="time" y="sum(price)" color="state" @@ -1428,7 +1487,8 @@ formatnumber "0.0a" *Code example* [source,text] ---- -filters +kibana +| selectFilter | demodata | math "mean(percent_uptime)" | progress shape="gauge" @@ -1609,11 +1669,7 @@ Aliases: `dataurl`, `url` |`string`, `null` |The HTTP(S) URL or `base64` data URL of an image. -Example value for the _Unnamed_ argument, formatted as a `base64` data URL: -[source, url] ------------- -data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIgogICB4bWxuczpjYz0iaHR0cDovL2NyZWF0aXZlY29tbW9ucy5vcmcvbnMjIgogICB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiCiAgIHhtbG5zOnN2Zz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciCiAgIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIKICAgdmlld0JveD0iMCAwIDI3MC42MDAwMSAyNjkuNTQ2NjYiCiAgIGhlaWdodD0iMjY5LjU0NjY2IgogICB3aWR0aD0iMjcwLjYwMDAxIgogICB4bWw6c3BhY2U9InByZXNlcnZlIgogICBpZD0ic3ZnMiIKICAgdmVyc2lvbj0iMS4xIj48bWV0YWRhdGEKICAgICBpZD0ibWV0YWRhdGE4Ij48cmRmOlJERj48Y2M6V29yawogICAgICAgICByZGY6YWJvdXQ9IiI+PGRjOmZvcm1hdD5pbWFnZS9zdmcreG1sPC9kYzpmb3JtYXQ+PGRjOnR5cGUKICAgICAgICAgICByZ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jM5LjgxLDIzOS44MjEgMCwyOS4xNiAtNC44OCw1Ny4xNjggLTE0LjUzLDgzLjQxOCBsIC0zMDQuMDgsNzEuMTYgLTY2LjE4LC0zNDQuODA5IiAvPjxwYXRoCiAgICAgICAgIGlkPSJwYXRoMjYiCiAgICAgICAgIHN0eWxlPSJmaWxsOiMzMTc3YTc7ZmlsbC1vcGFjaXR5OjE7ZmlsbC1ydWxlOm5vbnplcm87c3Ryb2tlOm5vbmUiCiAgICAgICAgIGQ9Im0gMTM4NS42Nyw3MjIuOTMgMzM0Ljc2LC03OC4zMDEgYyAxMzYuMDIsNDQuOTYxIDIzMC41NiwxNzUuMzUxIDIzMC41NiwzMTguNzYyIDAsMTM5LjMzOSAtODYuNTQsMjYzLjg1OSAtMjE2LjM4LDMxMy4wMzkgbCAtNDM3Ljg0LC0zODMuNTkgODguOSwtMTY5LjkxIiAvPjwvZz48L2c+PC9zdmc+ ------------- +Default: `null` |`mode` |`string` @@ -1669,6 +1725,20 @@ Default: `","` *Returns:* `string` +[float] +[[k_fns]] +== K + +[float] +[[kibana_fn]] +=== `kibana` + +Gets kibana global context + +*Accepts:* `kibana_context`, `null` + +*Returns:* `kibana_context` + [float] [[l_fns]] == L @@ -1771,27 +1841,29 @@ Adds a column calculated as the result of other columns. Changes are made only w |=== |Argument |Type |Description -|`id` - -|`string`, `null` -|An optional id of the resulting column. When no id is provided, the id will be looked up from the existing column by the provided name argument. If no column with this name exists yet, a new column with this name and an identical id will be added to the table. - |_Unnamed_ *** Aliases: `column`, `name` |`string` |The name of the resulting column. Names are not required to be unique. +|`copyMetaFrom` +|`string`, `null` +|If set, the meta object from the specified column id is copied over to the specified target column. If the column doesn't exist it silently fails. + +Default: `null` + |`expression` *** Aliases: `exp`, `fn`, `function` |`boolean`, `number`, `string`, `null` -|A Canvas expression that is passed to each row as a single row `datatable`. - -|`copyMetaFrom` +|An expression that is executed on every row, provided with a single-row `datatable` context and returning the cell value. +|`id` |`string`, `null` -|If set, the meta object from the specified column id is copied over to the specified target column. Throws an exception if the column doesn't exist +|An optional id of the resulting column. When no id is provided, the id will be looked up from the existing column by the provided name argument. If no column with this name exists yet, a new column with this name and an identical id will be added to the table. + +Default: `null` |=== *Returns:* `datatable` @@ -1851,33 +1923,29 @@ Alias: `expression` |`string` |An evaluated `TinyMath` expression. See https://www.elastic.co/guide/en/kibana/current/canvas-tinymath-functions.html. -|`onError` - +|`onError` |`string` -|In case the `TinyMath` evaluation fails or returns NaN, the return value is specified by onError. For example, `"null"`, `"zero"`, `"false"`, `"throw"`. When `"throw"`, it will throw an exception, terminating expression execution. - -Default: `"throw"` +|In case the `TinyMath` evaluation fails or returns NaN, the return value is specified by onError. When `'throw'`, it will throw an exception, terminating expression execution (default). |=== -*Returns:* `number` | `boolean` | `null` +*Returns:* Depends on your input and arguments [float] [[mathColumn_fn]] === `mathColumn` -Adds a column by evaluating `TinyMath` on each row. This function is optimized for math, so it performs better than the <> with a <>. +Adds a column by evaluating TinyMath on each row. This function is optimized for math, so it performs better than the mapColumn with a math + *Accepts:* `datatable` [cols="3*^<"] |=== |Argument |Type |Description -|id *** -|`string` -|id of the resulting column. Must be unique. +|_Unnamed_ *** -|name *** +Aliases: `column`, `name` |`string` |The name of the resulting column. Names are not required to be unique. @@ -1885,19 +1953,21 @@ Adds a column by evaluating `TinyMath` on each row. This function is optimized f Alias: `expression` |`string` -|A `TinyMath` expression evaluated on each row. See https://www.elastic.co/guide/en/kibana/current/canvas-tinymath-functions.html. - -|`onError` +|An evaluated `TinyMath` expression. See https://www.elastic.co/guide/en/kibana/current/canvas-tinymath-functions.html. -|`string` -|In case the `TinyMath` evaluation fails or returns NaN, the return value is specified by onError. For example, `"null"`, `"zero"`, `"false"`, `"throw"`. When `"throw"`, it will throw an exception, terminating expression execution. +|`copyMetaFrom` +|`string`, `null` +|If set, the meta object from the specified column id is copied over to the specified target column. If the column doesn't exist it silently fails. -Default: `"throw"` +Default: `null` -|`copyMetaFrom` +|`id` *** +|`string` +|id of the resulting column. Must be unique. -|`string`, `null` -|If set, the meta object from the specified column id is copied over to the specified target column. Throws an exception if the column doesn't exist +|`onError` +|`string` +|In case the `TinyMath` evaluation fails or returns NaN, the return value is specified by onError. When `'throw'`, it will throw an exception, terminating expression execution (default). |=== *Returns:* `datatable` @@ -1991,17 +2061,41 @@ Alias: `color` |`string` |The palette colors. Accepts an HTML color name, HEX, HSL, HSLA, RGB, or RGBA. +|`continuity` +|`string` +| + +Default: `"above"` + |`gradient` |`boolean` |Make a gradient palette where supported? Default: `false` +|`range` +|`string` +| + +Default: `"percent"` + +|`rangeMax` +|`number` +| + +|`rangeMin` +|`number` +| + |`reverse` |`boolean` |Reverse the palette? Default: `false` + +|`stop` † +|`number` +|The palette color stops. When used, it must be associated with each color. |=== *Returns:* `palette` @@ -2262,6 +2356,40 @@ Default: `20` [[r_fns]] == R +[float] +[[removeFilter_fn]] +=== `removeFilter` + +Removes filters from context + +*Accepts:* `kibana_context` + +[cols="3*^<"] +|=== +|Argument |Type |Description + +|_Unnamed_ + +Alias: `group` +|`string` +|Removes only filters belonging to the provided group + +|`from` +|`string` +|Removes only filters owned by the provided id + +|`ungrouped` + +Aliases: `nogroup`, `nogroups` +|`boolean` +|Should filters without group be removed + +Default: `false` +|=== + +*Returns:* `kibana_context` + + [float] [[render_fn]] === `render` @@ -2316,14 +2444,10 @@ Default: `null` |`string`, `null` |The image to repeat. Provide an image asset as a `base64` data URL, or pass in a sub-expression. -Example value for the `image` argument, formatted as a `base64` data URL: -[source, url] ------------- -data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%0A%3Csvg%20viewBox%3D%22-3.948730230331421%20-1.7549896240234375%20245.25946044921875%20241.40370178222656%22%20width%3D%22245.25946044921875%22%20height%3D%22241.40370178222656%22%20style%3D%22enable-background%3Anew%200%200%20686.2%20235.7%3B%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%20%20%3Cdefs%3E%0A%20%20%20%20%3Cstyle%20type%3D%22text%2Fcss%22%3E%0A%09.st0%7Bfill%3A%232D2D2D%3B%7D%0A%3C%2Fstyle%3E%0A%20%20%3C%2Fdefs%3E%0A%20%20%3Cg%20transform%3D%22matrix%281%2C%200%2C%200%2C%201%2C%200%2C%200%29%22%3E%0A%20%20%20%20%3Cg%3E%0A%20%20%20%20%20%20%3Cpath%20class%3D%22st0%22%20d%3D%22M329.4%2C160.3l4.7-0.5l0.3%2C9.6c-12.4%2C1.7-23%2C2.6-31.8%2C2.6c-11.7%2C0-20-3.4-24.9-10.2%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc-4.9-6.8-7.3-17.4-7.3-31.7c0-28.6%2C11.4-42.9%2C34.1-42.9c11%2C0%2C19.2%2C3.1%2C24.6%2C9.2c5.4%2C6.1%2C8.1%2C15.8%2C8.1%2C28.9l-0.7%2C9.3h-53.8%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc0%2C9%2C1.6%2C15.7%2C4.9%2C20c3.3%2C4.3%2C8.9%2C6.5%2C17%2C6.5C312.8%2C161.2%2C321.1%2C160.9%2C329.4%2C160.3z%20M325%2C124.9c0-10-1.6-17.1-4.8-21.2%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc-3.2-4.1-8.4-6.2-15.6-6.2c-7.2%2C0-12.7%2C2.2-16.3%2C6.5c-3.6%2C4.3-5.5%2C11.3-5.6%2C20.9H325z%22%2F%3E%0A%20%20%20%20%20%20%3Cpath%20class%3D%22st0%22%20d%3D%22M354.3%2C171.4V64h12.2v107.4H354.3z%22%2F%3E%0A%20%20%20%20%20%20%3Cpath%20class%3D%22st0%22%20d%3D%22M443.5%2C113.5v41.1c0%2C4.1%2C10.1%2C3.9%2C10.1%2C3.9l-0.6%2C10.8c-8.6%2C0-15.7%2C0.7-20-3.4c-9.8%2C4.3-19.5%2C6.1-29.3%2C6.1%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc-7.5%2C0-13.2-2.1-17.1-6.4c-3.9-4.2-5.9-10.3-5.9-18.3c0-7.9%2C2-13.8%2C6-17.5c4-3.7%2C10.3-6.1%2C18.9-6.9l25.6-2.4v-7%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc0-5.5-1.2-9.5-3.6-11.9c-2.4-2.4-5.7-3.6-9.8-3.6l-32.1%2C0V87.2h31.3c9.2%2C0%2C15.9%2C2.1%2C20.1%2C6.4C441.4%2C97.8%2C443.5%2C104.5%2C443.5%2C113.5%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bz%20M393.3%2C146.7c0%2C10%2C4.1%2C15%2C12.4%2C15c7.4%2C0%2C14.7-1.2%2C21.8-3.7l3.7-1.3v-26.9l-24.1%2C2.3c-4.9%2C0.4-8.4%2C1.8-10.6%2C4.2%26%2310%3B%26%239%3B%26%239%3B%26%239%3BC394.4%2C138.7%2C393.3%2C142.2%2C393.3%2C146.7z%22%2F%3E%0A%20%20%20%20%20%20%3Cpath%20class%3D%22st0%22%20d%3D%22M491.2%2C98.2c-11.8%2C0-17.8%2C4.1-17.8%2C12.4c0%2C3.8%2C1.4%2C6.5%2C4.1%2C8.1c2.7%2C1.6%2C8.9%2C3.2%2C18.6%2C4.9%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc9.7%2C1.7%2C16.5%2C4%2C20.5%2C7.1c4%2C3%2C6%2C8.7%2C6%2C17.1c0%2C8.4-2.7%2C14.5-8.1%2C18.4c-5.4%2C3.9-13.2%2C5.9-23.6%2C5.9c-6.7%2C0-29.2-2.5-29.2-2.5%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bl0.7-10.6c12.9%2C1.2%2C22.3%2C2.2%2C28.6%2C2.2c6.3%2C0%2C11.1-1%2C14.4-3c3.3-2%2C5-5.4%2C5-10.1c0-4.7-1.4-7.9-4.2-9.6c-2.8-1.7-9-3.3-18.6-4.8%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc-9.6-1.5-16.4-3.7-20.4-6.7c-4-2.9-6-8.4-6-16.3c0-7.9%2C2.8-13.8%2C8.4-17.6c5.6-3.8%2C12.6-5.7%2C20.9-5.7c6.6%2C0%2C29.6%2C1.7%2C29.6%2C1.7%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bv10.7C508.1%2C99%2C498.2%2C98.2%2C491.2%2C98.2z%22%2F%3E%0A%20%20%20%20%20%20%3Cpath%20class%3D%22st0%22%20d%3D%22M581.7%2C99.5h-25.9v39c0%2C9.3%2C0.7%2C15.5%2C2%2C18.4c1.4%2C2.9%2C4.6%2C4.4%2C9.7%2C4.4l14.5-1l0.8%2C10.1%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc-7.3%2C1.2-12.8%2C1.8-16.6%2C1.8c-8.5%2C0-14.3-2.1-17.6-6.2c-3.3-4.1-4.9-12-4.9-23.6V99.5h-11.6V88.9h11.6V63.9h12.1v24.9h25.9V99.5z%22%2F%3E%0A%20%20%20%20%20%20%3Cpath%20class%3D%22st0%22%20d%3D%22M598.7%2C78.4V64.3h12.2v14.2H598.7z%20M598.7%2C171.4V88.9h12.2v82.5H598.7z%22%2F%3E%0A%20%20%20%20%20%20%3Cpath%20class%3D%22st0%22%20d%3D%22M663.8%2C87.2c3.6%2C0%2C9.7%2C0.7%2C18.3%2C2l3.9%2C0.5l-0.5%2C9.9c-8.7-1-15.1-1.5-19.2-1.5c-9.2%2C0-15.5%2C2.2-18.8%2C6.6%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc-3.3%2C4.4-5%2C12.6-5%2C24.5c0%2C11.9%2C1.5%2C20.2%2C4.6%2C24.9c3.1%2C4.7%2C9.5%2C7%2C19.3%2C7l19.2-1.5l0.5%2C10.1c-10.1%2C1.5-17.7%2C2.3-22.7%2C2.3%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc-12.7%2C0-21.5-3.3-26.3-9.8c-4.8-6.5-7.3-17.5-7.3-33c0-15.5%2C2.6-26.4%2C7.8-32.6C643%2C90.4%2C651.7%2C87.2%2C663.8%2C87.2z%22%2F%3E%0A%20%20%20%20%3C%2Fg%3E%0A%20%20%20%20%3Cpath%20class%3D%22st0%22%20d%3D%22M236.6%2C123.5c0-19.8-12.3-37.2-30.8-43.9c0.8-4.2%2C1.2-8.4%2C1.2-12.7C207%2C30%2C177%2C0%2C140.2%2C0%26%2310%3B%26%239%3B%26%239%3BC118.6%2C0%2C98.6%2C10.3%2C86%2C27.7c-6.2-4.8-13.8-7.4-21.7-7.4c-19.6%2C0-35.5%2C15.9-35.5%2C35.5c0%2C4.3%2C0.8%2C8.5%2C2.2%2C12.4%26%2310%3B%26%239%3B%26%239%3BC12.6%2C74.8%2C0%2C92.5%2C0%2C112.2c0%2C19.9%2C12.4%2C37.3%2C30.9%2C44c-0.8%2C4.1-1.2%2C8.4-1.2%2C12.7c0%2C36.8%2C29.9%2C66.7%2C66.7%2C66.7%26%2310%3B%26%239%3B%26%239%3Bc21.6%2C0%2C41.6-10.4%2C54.1-27.8c6.2%2C4.9%2C13.8%2C7.6%2C21.7%2C7.6c19.6%2C0%2C35.5-15.9%2C35.5-35.5c0-4.3-0.8-8.5-2.2-12.4%26%2310%3B%26%239%3B%26%239%3BC223.9%2C160.9%2C236.6%2C143.2%2C236.6%2C123.5z%20M91.6%2C34.8c10.9-15.9%2C28.9-25.4%2C48.1-25.4c32.2%2C0%2C58.4%2C26.2%2C58.4%2C58.4%26%2310%3B%26%239%3B%26%239%3Bc0%2C3.9-0.4%2C7.7-1.1%2C11.5l-52.2%2C45.8L93%2C101.5L82.9%2C79.9L91.6%2C34.8z%20M65.4%2C29c6.2%2C0%2C12.1%2C2%2C17%2C5.7l-7.8%2C40.3l-35.5-8.4%26%2310%3B%26%239%3B%26%239%3Bc-1.1-3.1-1.7-6.3-1.7-9.7C37.4%2C41.6%2C49.9%2C29%2C65.4%2C29z%20M9.1%2C112.3c0-16.7%2C11-31.9%2C26.9-37.2L75%2C84.4l9.1%2C19.5l-49.8%2C45%26%2310%3B%26%239%3B%26%239%3BC19.2%2C143.1%2C9.1%2C128.6%2C9.1%2C112.3z%20M145.2%2C200.9c-10.9%2C16.1-29%2C25.6-48.4%2C25.6c-32.3%2C0-58.6-26.3-58.6-58.5c0-4%2C0.4-7.9%2C1.1-11.7%26%2310%3B%26%239%3B%26%239%3Bl50.9-46l52%2C23.7l11.5%2C22L145.2%2C200.9z%20M171.2%2C206.6c-6.1%2C0-12-2-16.9-5.8l7.7-40.2l35.4%2C8.3c1.1%2C3.1%2C1.7%2C6.3%2C1.7%2C9.7%26%2310%3B%26%239%3B%26%239%3BC199.2%2C194.1%2C186.6%2C206.6%2C171.2%2C206.6z%20M200.5%2C160.5l-39-9.1l-10.4-19.8l51-44.7c15.1%2C5.7%2C25.2%2C20.2%2C25.2%2C36.5%26%2310%3B%26%239%3B%26%239%3BC227.4%2C140.1%2C216.4%2C155.3%2C200.5%2C160.5z%22%2F%3E%0A%20%20%3C%2Fg%3E%0A%3C%2Fsvg%3E ------------- +Default: `null` |`max` -|`number` +|`number`, `null` |The maximum number of times the image can repeat. Default: `1000` @@ -2396,11 +2520,7 @@ Default: `null` |`string`, `null` |The image to reveal. Provide an image asset as a `base64` data URL, or pass in a sub-expression. -Example value for the `image` argument, formatted as a `base64` data URL: -[source, url] ------------- -data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%0A%3Csvg%20viewBox%3D%22-3.948730230331421%20-1.7549896240234375%20245.25946044921875%20241.40370178222656%22%20width%3D%22245.25946044921875%22%20height%3D%22241.40370178222656%22%20style%3D%22enable-background%3Anew%200%200%20686.2%20235.7%3B%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%20%20%3Cdefs%3E%0A%20%20%20%20%3Cstyle%20type%3D%22text%2Fcss%22%3E%0A%09.st0%7Bfill%3A%232D2D2D%3B%7D%0A%3C%2Fstyle%3E%0A%20%20%3C%2Fdefs%3E%0A%20%20%3Cg%20transform%3D%22matrix%281%2C%200%2C%200%2C%201%2C%200%2C%200%29%22%3E%0A%20%20%20%20%3Cg%3E%0A%20%20%20%20%20%20%3Cpath%20class%3D%22st0%22%20d%3D%22M329.4%2C160.3l4.7-0.5l0.3%2C9.6c-12.4%2C1.7-23%2C2.6-31.8%2C2.6c-11.7%2C0-20-3.4-24.9-10.2%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc-4.9-6.8-7.3-17.4-7.3-31.7c0-28.6%2C11.4-42.9%2C34.1-42.9c11%2C0%2C19.2%2C3.1%2C24.6%2C9.2c5.4%2C6.1%2C8.1%2C15.8%2C8.1%2C28.9l-0.7%2C9.3h-53.8%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc0%2C9%2C1.6%2C15.7%2C4.9%2C20c3.3%2C4.3%2C8.9%2C6.5%2C17%2C6.5C312.8%2C161.2%2C321.1%2C160.9%2C329.4%2C160.3z%20M325%2C124.9c0-10-1.6-17.1-4.8-21.2%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc-3.2-4.1-8.4-6.2-15.6-6.2c-7.2%2C0-12.7%2C2.2-16.3%2C6.5c-3.6%2C4.3-5.5%2C11.3-5.6%2C20.9H325z%22%2F%3E%0A%20%20%20%20%20%20%3Cpath%20class%3D%22st0%22%20d%3D%22M354.3%2C171.4V64h12.2v107.4H354.3z%22%2F%3E%0A%20%20%20%20%20%20%3Cpath%20class%3D%22st0%22%20d%3D%22M443.5%2C113.5v41.1c0%2C4.1%2C10.1%2C3.9%2C10.1%2C3.9l-0.6%2C10.8c-8.6%2C0-15.7%2C0.7-20-3.4c-9.8%2C4.3-19.5%2C6.1-29.3%2C6.1%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc-7.5%2C0-13.2-2.1-17.1-6.4c-3.9-4.2-5.9-10.3-5.9-18.3c0-7.9%2C2-13.8%2C6-17.5c4-3.7%2C10.3-6.1%2C18.9-6.9l25.6-2.4v-7%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc0-5.5-1.2-9.5-3.6-11.9c-2.4-2.4-5.7-3.6-9.8-3.6l-32.1%2C0V87.2h31.3c9.2%2C0%2C15.9%2C2.1%2C20.1%2C6.4C441.4%2C97.8%2C443.5%2C104.5%2C443.5%2C113.5%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bz%20M393.3%2C146.7c0%2C10%2C4.1%2C15%2C12.4%2C15c7.4%2C0%2C14.7-1.2%2C21.8-3.7l3.7-1.3v-26.9l-24.1%2C2.3c-4.9%2C0.4-8.4%2C1.8-10.6%2C4.2%26%2310%3B%26%239%3B%26%239%3B%26%239%3BC394.4%2C138.7%2C393.3%2C142.2%2C393.3%2C146.7z%22%2F%3E%0A%20%20%20%20%20%20%3Cpath%20class%3D%22st0%22%20d%3D%22M491.2%2C98.2c-11.8%2C0-17.8%2C4.1-17.8%2C12.4c0%2C3.8%2C1.4%2C6.5%2C4.1%2C8.1c2.7%2C1.6%2C8.9%2C3.2%2C18.6%2C4.9%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc9.7%2C1.7%2C16.5%2C4%2C20.5%2C7.1c4%2C3%2C6%2C8.7%2C6%2C17.1c0%2C8.4-2.7%2C14.5-8.1%2C18.4c-5.4%2C3.9-13.2%2C5.9-23.6%2C5.9c-6.7%2C0-29.2-2.5-29.2-2.5%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bl0.7-10.6c12.9%2C1.2%2C22.3%2C2.2%2C28.6%2C2.2c6.3%2C0%2C11.1-1%2C14.4-3c3.3-2%2C5-5.4%2C5-10.1c0-4.7-1.4-7.9-4.2-9.6c-2.8-1.7-9-3.3-18.6-4.8%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc-9.6-1.5-16.4-3.7-20.4-6.7c-4-2.9-6-8.4-6-16.3c0-7.9%2C2.8-13.8%2C8.4-17.6c5.6-3.8%2C12.6-5.7%2C20.9-5.7c6.6%2C0%2C29.6%2C1.7%2C29.6%2C1.7%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bv10.7C508.1%2C99%2C498.2%2C98.2%2C491.2%2C98.2z%22%2F%3E%0A%20%20%20%20%20%20%3Cpath%20class%3D%22st0%22%20d%3D%22M581.7%2C99.5h-25.9v39c0%2C9.3%2C0.7%2C15.5%2C2%2C18.4c1.4%2C2.9%2C4.6%2C4.4%2C9.7%2C4.4l14.5-1l0.8%2C10.1%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc-7.3%2C1.2-12.8%2C1.8-16.6%2C1.8c-8.5%2C0-14.3-2.1-17.6-6.2c-3.3-4.1-4.9-12-4.9-23.6V99.5h-11.6V88.9h11.6V63.9h12.1v24.9h25.9V99.5z%22%2F%3E%0A%20%20%20%20%20%20%3Cpath%20class%3D%22st0%22%20d%3D%22M598.7%2C78.4V64.3h12.2v14.2H598.7z%20M598.7%2C171.4V88.9h12.2v82.5H598.7z%22%2F%3E%0A%20%20%20%20%20%20%3Cpath%20class%3D%22st0%22%20d%3D%22M663.8%2C87.2c3.6%2C0%2C9.7%2C0.7%2C18.3%2C2l3.9%2C0.5l-0.5%2C9.9c-8.7-1-15.1-1.5-19.2-1.5c-9.2%2C0-15.5%2C2.2-18.8%2C6.6%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc-3.3%2C4.4-5%2C12.6-5%2C24.5c0%2C11.9%2C1.5%2C20.2%2C4.6%2C24.9c3.1%2C4.7%2C9.5%2C7%2C19.3%2C7l19.2-1.5l0.5%2C10.1c-10.1%2C1.5-17.7%2C2.3-22.7%2C2.3%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc-12.7%2C0-21.5-3.3-26.3-9.8c-4.8-6.5-7.3-17.5-7.3-33c0-15.5%2C2.6-26.4%2C7.8-32.6C643%2C90.4%2C651.7%2C87.2%2C663.8%2C87.2z%22%2F%3E%0A%20%20%20%20%3C%2Fg%3E%0A%20%20%20%20%3Cpath%20class%3D%22st0%22%20d%3D%22M236.6%2C123.5c0-19.8-12.3-37.2-30.8-43.9c0.8-4.2%2C1.2-8.4%2C1.2-12.7C207%2C30%2C177%2C0%2C140.2%2C0%26%2310%3B%26%239%3B%26%239%3BC118.6%2C0%2C98.6%2C10.3%2C86%2C27.7c-6.2-4.8-13.8-7.4-21.7-7.4c-19.6%2C0-35.5%2C15.9-35.5%2C35.5c0%2C4.3%2C0.8%2C8.5%2C2.2%2C12.4%26%2310%3B%26%239%3B%26%239%3BC12.6%2C74.8%2C0%2C92.5%2C0%2C112.2c0%2C19.9%2C12.4%2C37.3%2C30.9%2C44c-0.8%2C4.1-1.2%2C8.4-1.2%2C12.7c0%2C36.8%2C29.9%2C66.7%2C66.7%2C66.7%26%2310%3B%26%239%3B%26%239%3Bc21.6%2C0%2C41.6-10.4%2C54.1-27.8c6.2%2C4.9%2C13.8%2C7.6%2C21.7%2C7.6c19.6%2C0%2C35.5-15.9%2C35.5-35.5c0-4.3-0.8-8.5-2.2-12.4%26%2310%3B%26%239%3B%26%239%3BC223.9%2C160.9%2C236.6%2C143.2%2C236.6%2C123.5z%20M91.6%2C34.8c10.9-15.9%2C28.9-25.4%2C48.1-25.4c32.2%2C0%2C58.4%2C26.2%2C58.4%2C58.4%26%2310%3B%26%239%3B%26%239%3Bc0%2C3.9-0.4%2C7.7-1.1%2C11.5l-52.2%2C45.8L93%2C101.5L82.9%2C79.9L91.6%2C34.8z%20M65.4%2C29c6.2%2C0%2C12.1%2C2%2C17%2C5.7l-7.8%2C40.3l-35.5-8.4%26%2310%3B%26%239%3B%26%239%3Bc-1.1-3.1-1.7-6.3-1.7-9.7C37.4%2C41.6%2C49.9%2C29%2C65.4%2C29z%20M9.1%2C112.3c0-16.7%2C11-31.9%2C26.9-37.2L75%2C84.4l9.1%2C19.5l-49.8%2C45%26%2310%3B%26%239%3B%26%239%3BC19.2%2C143.1%2C9.1%2C128.6%2C9.1%2C112.3z%20M145.2%2C200.9c-10.9%2C16.1-29%2C25.6-48.4%2C25.6c-32.3%2C0-58.6-26.3-58.6-58.5c0-4%2C0.4-7.9%2C1.1-11.7%26%2310%3B%26%239%3B%26%239%3Bl50.9-46l52%2C23.7l11.5%2C22L145.2%2C200.9z%20M171.2%2C206.6c-6.1%2C0-12-2-16.9-5.8l7.7-40.2l35.4%2C8.3c1.1%2C3.1%2C1.7%2C6.3%2C1.7%2C9.7%26%2310%3B%26%239%3B%26%239%3BC199.2%2C194.1%2C186.6%2C206.6%2C171.2%2C206.6z%20M200.5%2C160.5l-39-9.1l-10.4-19.8l51-44.7c15.1%2C5.7%2C25.2%2C20.2%2C25.2%2C36.5%26%2310%3B%26%239%3B%26%239%3BC227.4%2C140.1%2C216.4%2C155.3%2C200.5%2C160.5z%22%2F%3E%0A%20%20%3C%2Fg%3E%0A%3C%2Fsvg%3E ------------- +Default: `null` |`origin` |`string` @@ -2449,99 +2569,37 @@ Returns the number of rows. Pairs with <> to get the count of unique col == S [float] -[[savedLens_fn]] -=== `savedLens` - -Returns an embeddable for a saved Lens visualization object. - -*Accepts:* `any` - -[cols="3*^<"] -|=== -|Argument |Type |Description - -|`id` -|`string` -|The ID of the saved Lens visualization object - -|`timerange` -|`timerange` -|The timerange of data that should be included - -|`title` -|`string` -|The title for the Lens visualization object -|=== - -*Returns:* `embeddable` - - -[float] -[[savedMap_fn]] -=== `savedMap` +[[selectFilter_fn]] +=== `selectFilter` -Returns an embeddable for a saved map object. +Selects filters from context -*Accepts:* `any` +*Accepts:* `kibana_context` [cols="3*^<"] |=== |Argument |Type |Description -|`center` -|`mapCenter` -|The center and zoom level the map should have - -|`hideLayer` † -|`string` -|The IDs of map layers that should be hidden +|_Unnamed_ † -|`id` +Alias: `group` |`string` -|The ID of the saved map object +|Select only filters belonging to the provided group -|`timerange` -|`timerange` -|The timerange of data that should be included - -|`title` +|`from` |`string` -|The title for the map -|=== - -*Returns:* `embeddable` - - -[float] -[[savedVisualization_fn]] -=== `savedVisualization` - -Returns an embeddable for a saved visualization object. - -*Accepts:* `any` - -[cols="3*^<"] -|=== -|Argument |Type |Description +|Select only filters owned by the provided id -|`colors` † -|`seriesStyle` -|Defines the color to use for a specific series +|`ungrouped` -|`hideLegend` +Aliases: `nogroup`, `nogroups` |`boolean` -|Specifies the option to hide the legend +|Should filters without group be included -|`id` -|`string` -|The ID of the saved visualization object - -|`timerange` -|`timerange` -|The timerange of data that should be included +Default: `false` |=== -*Returns:* `embeddable` +*Returns:* `kibana_context` [float] @@ -2641,7 +2699,7 @@ Default: `"black"` Default: `false` |=== -*Returns:* `shape` +*Returns:* Depends on your input and arguments [float] @@ -2676,7 +2734,7 @@ Default: `false` [[staticColumn_fn]] === `staticColumn` -Adds a column with the same static value in every row. See also <>, <>, and <>. +Adds a column with the same static value in every row. See also <>, <>, and <> *Accepts:* `datatable` @@ -2994,7 +3052,7 @@ Alias: `type` Returns a UI settings parameter value. -*Accepts:* `null` +*Accepts:* `any` [cols="3*^<"] |=== @@ -3002,18 +3060,17 @@ Returns a UI settings parameter value. |_Unnamed_ *** -Aliases: `parameter` +Alias: `parameter` |`string` |The parameter name. |`default` |`any` |A default value in case of the parameter is not set. - -Default: `null` |=== -*Returns:* `ui_setting` +*Returns:* Depends on your input and arguments + [float] [[urlparam_fn]] @@ -3080,13 +3137,13 @@ Updates the Kibana global context. |=== |Argument |Type |Description -|_Unnamed_ *** +|_Unnamed_ *** † Alias: `name` |`string` |Specify the name of the variable. -|`value` +|`value` † Alias: `val` |`any` diff --git a/src/plugins/expressions/common/expression_functions/specs/clog.ts b/src/plugins/expressions/common/expression_functions/specs/clog.ts index a523d7505648f9..6936b704b878ee 100644 --- a/src/plugins/expressions/common/expression_functions/specs/clog.ts +++ b/src/plugins/expressions/common/expression_functions/specs/clog.ts @@ -13,7 +13,7 @@ export type ExpressionFunctionClog = ExpressionFunctionDefinition<'clog', unknow export const clog: ExpressionFunctionClog = { name: 'clog', args: {}, - help: 'Outputs the context to the console', + help: 'Outputs the _input_ in the console. This function is for debug purposes', fn: (input: unknown) => { // eslint-disable-next-line no-console console.log(input); diff --git a/src/plugins/expressions/common/expression_functions/specs/math_column.ts b/src/plugins/expressions/common/expression_functions/specs/math_column.ts index fe6049b49c9693..35748ff0b9d263 100644 --- a/src/plugins/expressions/common/expression_functions/specs/math_column.ts +++ b/src/plugins/expressions/common/expression_functions/specs/math_column.ts @@ -28,13 +28,8 @@ export const mathColumn: ExpressionFunctionDefinition< inputTypes: ['datatable'], help: i18n.translate('expressions.functions.mathColumnHelpText', { defaultMessage: - 'Adds a column calculated as the result of other columns. ' + - 'Changes are made only when you provide arguments.' + - 'See also {alterColumnFn} and {staticColumnFn}.', - values: { - alterColumnFn: '`alterColumn`', - staticColumnFn: '`staticColumn`', - }, + 'Adds a column by evaluating TinyMath on each row. ' + + 'This function is optimized for math, so it performs better than the mapColumn with a math', }), args: { ...math.args, diff --git a/x-pack/plugins/canvas/i18n/functions/dict/alter_column.ts b/x-pack/plugins/canvas/i18n/functions/dict/alter_column.ts index 25975410ef8bcd..795a70abb981aa 100644 --- a/x-pack/plugins/canvas/i18n/functions/dict/alter_column.ts +++ b/x-pack/plugins/canvas/i18n/functions/dict/alter_column.ts @@ -15,7 +15,7 @@ export const help: FunctionHelp> = { help: i18n.translate('xpack.canvas.functions.alterColumnHelpText', { defaultMessage: 'Converts between core types, including {list}, and {end}, and renames columns. ' + - 'See also {mapColumnFn} and {staticColumnFn}.', + 'See also {mapColumnFn}, {mathColumnFn}, and {staticColumnFn}.', values: { list: Object.values(DATATABLE_COLUMN_TYPES) .slice(0, -1) @@ -24,6 +24,7 @@ export const help: FunctionHelp> = { end: `\`${Object.values(DATATABLE_COLUMN_TYPES).slice(-1)[0]}\``, mapColumnFn: '`mapColumn`', staticColumnFn: '`staticColumn`', + mathColumnFn: '`mathColumn`', }, }), args: { diff --git a/x-pack/plugins/canvas/i18n/functions/dict/static_column.ts b/x-pack/plugins/canvas/i18n/functions/dict/static_column.ts index 3b5a632edf9937..a27c1491fc0af9 100644 --- a/x-pack/plugins/canvas/i18n/functions/dict/static_column.ts +++ b/x-pack/plugins/canvas/i18n/functions/dict/static_column.ts @@ -13,10 +13,11 @@ import { FunctionFactory } from '../../../types'; export const help: FunctionHelp> = { help: i18n.translate('xpack.canvas.functions.staticColumnHelpText', { defaultMessage: - 'Adds a column with the same static value in every row. See also {alterColumnFn} and {mapColumnFn}.', + 'Adds a column with the same static value in every row. See also {alterColumnFn}, {mapColumnFn}, and {mathColumnFn}', values: { alterColumnFn: '`alterColumn`', mapColumnFn: '`mapColumn`', + mathColumnFn: '`mathColumn`', }, }), args: { diff --git a/x-pack/plugins/canvas/public/components/function_reference_generator/function_examples.ts b/x-pack/plugins/canvas/public/components/function_reference_generator/function_examples.ts index 785f183b193f13..c25e163a0c2102 100644 --- a/x-pack/plugins/canvas/public/components/function_reference_generator/function_examples.ts +++ b/x-pack/plugins/canvas/public/components/function_reference_generator/function_examples.ts @@ -134,6 +134,20 @@ case if={lte 50} then="green"`, help: 'This sets the color of the progress indicator and the color of the label to `"green"` if the value is less than or equal to `0.5`, `"orange"` if the value is greater than `0.5` and less than or equal to `0.75`, and `"red"` if `none` of the case conditions are met.', }, }, + clog: { + syntax: `clog`, + usage: { + expression: `kibana +| demodata +| clog +| filterrows fn={getCell "age" | gt 70} +| clog +| pointseries x="time" y="mean(price)" +| plot defaultStyle={seriesStyle lines=1 fill=1} +| render`, + help: 'This prints the `datatable` objects in the browser console before and after the `filterrows` function.', + }, + }, columns: { syntax: `columns include="@timestamp, projects, cost" columns exclude="username, country, age"`, @@ -199,6 +213,23 @@ containerStyle backgroundImage={asset id=asset-f40d2292-cf9e-4f2c-8c6f-a504a25e9 help: 'Using the `context` function allows us to pass the output, or _context_, of the previous function as a value to an argument in the next function. Here we get the formatted date string from the previous function and pass it as `content` for the markdown element.', }, }, + createTable: { + syntax: `createTable id="a" id="b" +createTable id="a" name="A" id="b" name="B" rowCount=5`, + usage: { + expression: `var_set +name="logs" value={essql "select count(*) as a from kibana_sample_data_logs"} +name="commerce" value={essql "select count(*) as b from kibana_sample_data_ecommerce"} +| createTable ids="totalA" ids="totalB" +| staticColumn name="totalA" value={var "logs" | getCell "a"} +| alterColumn column="totalA" type="number" +| staticColumn name="totalB" value={var "commerce" | getCell "b"} +| alterColumn column="totalB" type="number" +| mathColumn id="percent" name="percent" expression="totalA / totalB" +| render`, + help: 'This creates a table based on the results of two `essql` queries, joined into one table.', + }, + }, csv: { syntax: `csv "fruit, stock kiwi, 10 diff --git a/x-pack/plugins/canvas/public/components/function_reference_generator/generate_function_reference.ts b/x-pack/plugins/canvas/public/components/function_reference_generator/generate_function_reference.ts index 289704ae795394..7f7f897b4f28eb 100644 --- a/x-pack/plugins/canvas/public/components/function_reference_generator/generate_function_reference.ts +++ b/x-pack/plugins/canvas/public/components/function_reference_generator/generate_function_reference.ts @@ -26,12 +26,32 @@ const fnList = [ ...browserFunctions.map((fn) => fn().name), ...serverFunctions.map((fn) => fn().name), 'asset', + 'clog', + 'createTable', + 'embeddable', 'filters', + 'font', + 'image', + 'kibana', + 'mapColumn', + 'math', + 'mathColumn', + 'metric', + 'palette', + 'pie', + 'plot', + 'progress', + 'removeFilter', + 'repeatImage', + 'revealImage', + 'selectFilter', + 'shape', 'timelion', 'to', - 'font', + 'uiSetting', 'var', 'var_set', + // ignore unsupported embeddables functions for now ].filter((fn) => !['savedSearch'].includes(fn));