[DOCS] Adds Kibana docs for Canvas functions (#26467) (#26733)

* [DOCS] Migrates Canvas function docs to Kibana docs

* [DOCS] Add docs for TinyMath Canvas functions
This commit is contained in:
Sarah Hersh 2018-12-06 08:06:02 -05:00 committed by GitHub
parent 776eacd91c
commit 5246301729
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 2922 additions and 3 deletions

View file

@ -16,8 +16,16 @@ you make neat stuff and you want to show that neat stuff to others. Canvas is
for makers who are a little bit creative, a little bit technical, and whole lot
of curious.
We've put together <<canvas-getting-started, this Getting Started>> to teach you
how to get the most out of Canvas.
[role="screenshot"]
image::images/canvas_workpad_weblog.png[]
We've put together <<canvas-getting-started, this Getting Started>> to get you
up and running with Canvas.
If you want to dig into the expression language and the functions that drive
Canvas, see the <<canvas-common-functions>> and
<<canvas-tinymath-functions>>.
--
@ -25,3 +33,12 @@ include::canvas/canvas-getting-started.asciidoc[]
include::canvas/canvas-workpad.asciidoc[]
include::canvas/canvas-function-reference.asciidoc[]
include::canvas/canvas-common-functions.asciidoc[]
include::canvas/canvas-server-functions.asciidoc[]
include::canvas/canvas-client-functions.asciidoc[]
include::canvas/canvas-tinymath-functions.asciidoc[]

View file

@ -0,0 +1,82 @@
[[canvas-client-functions]]
=== Canvas client functions
beta[]These functions must execute in a browser. They are only available
from within the Canvas application, not via the Canvas HTTP API. These functions must
execute in the browser because they use browser specific APIs, such as location,
or interact with the workpad to read filters.
A *** denotes a required argument.
[float]
=== asset
Uses Canvas workpad asset objects to provide argument values. Usually images.
*Accepts:* null
[cols="3*^<"]
|===
s|Argument
s|Type
s|Description
|_Unnamed_*
|string
|The ID of the asset value to return
|===
*Returns:* string
[float]
=== browser
Forces the interpreter to return to the browser.
*Accepts:* Anything or nothing
*Returns:* Depends on your input and arguments
[float]
=== filters
Collects element filters on the workpad, usually to provide them to a data source.
*Accepts:* null
*Returns:* filter
[float]
=== location
Uses the browser's location functionality to get your current location. Usually
quite slow, but fairly accurate.
*Accepts:* null
*Returns:* datatable
[float]
=== urlparam
Accesses URL parameters and use them in expressions. This will always return a string.
*Accepts:* null
[cols="3*^<"]
|===
s|Argument
s|Type
s|Description
|_Unnamed_* (Aliases: `var`, `variable`)
|string
|The URL hash parameter to access
|default
|string
|Return this string if the url parameter is not defined (default: `""`)
|===
*Returns:* string

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,16 @@
[[canvas-function-reference]]
== Canvas function reference
beta[] Behind the scenes, Canvas is driven by a powerful expression language,
with dozens of functions and other capabilities, including table transforms,
type casting, and sub-expressions.
For the purpose of this documentation,
the Canvas functions are divided by the environment they run in:
* <<canvas-common-functions>> can run anywhere
* <<canvas-server-functions>> can only execute on the server
* <<canvas-client-functions>> must execute in a browser
The Canvas expression language also supports <<canvas-tinymath-functions>>, which
perform complex math calculations.

View file

@ -0,0 +1,210 @@
[[canvas-server-functions]]
=== Canvas server functions
beta[]These functions can only execute on the server. This may be for performance
or security reasons, or because the function uses an API only available on the
{kib} server. If the expression is executing in the browser, it will transfer to
the server when it hits one of these functions.
A *** denotes a required argument.
[float]
=== demodata
A mock data set that includes project CI times with usernames, countries, and run phases.
*Accepts:* filter
[cols="3*^<"]
|===
s|Argument
s|Type
s|Description
|_Unnamed_ (Alias: `type`)
|string
|The name of the demo data set to use (default: `ci`)
|===
*Returns:* datatable
[float]
=== esdocs
Queries {es} and gets back raw documents. Specify the fields you want to receive,
especially if you are asking for a lot of rows.
*Accepts:* filter
[cols="3*^<"]
|===
s|Argument
s|Type
s|Description
|index
|string
|Specify an index pattern, for example, "logstash-*" (default is `_all`)
|_Unnamed_ (Aliases: `query`, `q`)
|string
|A Lucene query string (default: `_index:.kibana`)
|sort
|string
|Sort directions as "field, direction", for example, "@timestamp, desc" or "bytes, asc"
|fields
|string
|Comma separated list of fields. Fewer fields will perform better
|metaFields
|string
|Comma separated list of meta fields, for example, "_index,_type"
|count
|number
|The number of docs to pull back. Smaller numbers perform better (default: `100`)
|===
*Returns:* datatable
[float]
=== escount
Queries {es} for a count of the number of hits matching a query.
*Accepts:* filter
[cols="3*^<"]
|===
s|Argument
s|Type
s|Description
|index
|string
|Specify an index pattern, for example, "logstash-*" (default: `all`)
|_Unnamed_ (Alias: `query`, `q`)
|string
|A Lucene query string (default: `"-_index:.kibana"`)
|===
*Returns:* number
[float]
=== essql
Specifies an {es} SQL.
*Accepts:* filter
[cols="3*^<"]
|===
s|Argument
s|Type
s|Description
|_Unnamed_* (Alias: `query`, `q`)
|string
|An SQL query
|count
|number
|The default is `1000`
|===
*Returns:* datatable
[float]
=== pointseries
Turns a datatable into a point series model. Currently Canvas differentiates measure
from dimensions by looking for a <<canvas-tinymath-functions, Tiny Math function>>. If you enter a TinyMath
expression in your argument, Canvas treats that argument as a measure. Otherwise, it
is a dimension. Dimensions are combined to create unique keys. Measures are
then deduplicated by those keys using the specified TinyMath function.
*Accepts:* datatable
[cols="3*^<"]
|===
s|Argument
s|Type
s|Description
|x
|string
|The values along the X-axis
|y
|string
|The values along the Y-axis
|color
|string
|An expression to use in determining the mark's color
|size
|string
|For elements that support it, the size of the marks
|text
|string
|For use in charts that support it, the text to show in the mark
|===
*Returns:* pointseries
[float]
=== server
Forces the interpreter to return to the server.
*Accepts:* Anything or nothing
*Returns:* Depends on your input and arguments
&nbsp;
[float]
=== timelion
Uses Timelion to extract one or more time series from many sources.
*Accepts:* filter
[cols="3*^<"]
|===
s|Argument
s|Type
s|Description
|_Unnamed_ (Aliases: `query`, `q`)
|string
|A Timelion query (default: `".es(*)"`)
|interval
|string
|Bucket interval for the time series (default: `auto`)
|from
|any
|{es} date math string for the start of the time range (default: `now-1y`)
|to
|any
|{es} date math string for the end of the time range (default: `now`)
|timezone
|any
|Time zone for the time range (default: `UTC`)
|===
*Returns:* datatable

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,5 @@
[[canvas-workpad]]
== Using the workpad
=== Using the workpad
beta[]Now that you have a workpad with sample data that you can mess with, lets mess with it.
Well start out by making a few stylistic changes.

Binary file not shown.

After

Width:  |  Height:  |  Size: 313 KiB