kibana/docs/extend/kibana-expressions-plugin.md
Colleen McGinnis 907cd5904b
[docs] Fix image paths for docs-assembler (#218344)
Fixes image paths to work with docs-assembler.

Notes for the reviewer:
* I was not able to get images in reference, extend, or release-notes to
work using the `:::{image}` syntax because it seems to resolve
differently than the Markdown `![]()` syntax. We should address this in
docs-builder, but in order to get images working as soon as possible,
I've used Markdown syntax and left us a `TO DO` in a code comment to add
back the `screenshot` class where applicable.
* Can you please add the appropriate labels needed for backporting?
2025-04-15 16:59:57 -05:00

2.2 KiB

mapped_pages
https://www.elastic.co/guide/en/kibana/current/kibana-expressions-plugin.html

expressions plugin [kibana-expressions-plugin]

Expression pipeline is a chain of functions that pipe its output to the input of the next function. Functions can be configured using arguments provided by the user. The final output of the expression pipeline can be rendered using one of the renderers registered in expressions plugin.

All the arguments to expression functions need to be serializable, as well as input and output. Expression functions should try to stay pure. This makes functions easy to reuse and also make it possible to serialize the whole chain as well as output at every step of execution.

It is possible to add comments to expressions by starting them with a // sequence or by using /* and */ to enclose multi-line comments.

Expressions power visualizations in Dashboard and Lens, as well as, every element in Canvas is backed by an expression.

This plugin provides methods which will parse & execute an expression pipeline string for you, as well as a series of registries for advanced users who might want to incorporate their own functions, types, and renderers into the service for use in their own application.

Examples [_examples_8]

Below is an example of serialized expression for one Canvas element that fetches data using essql function, pipes it further to math and metric functions, and final render function renders the result.

filters
| essql
  query="SELECT COUNT(timestamp) as total_errors
    FROM kibana_sample_data_logs
    WHERE tags LIKE '%warning%' OR tags LIKE '%error%'"
| math "total_errors" // take "total_errors" column
/* Represent as a number over a label */
| metric "TOTAL ISSUES"
  metricFont={font family="'Open Sans', Helvetica, Arial, sans-serif" size=48 align="left" color="#FFFFFF" weight="normal" underline=false italic=false}
  labelFont={font family="'Open Sans', Helvetica, Arial, sans-serif" size=30 align="left" color="#FFFFFF" weight="lighter" underline=false italic=false}
| render
[/source]

% TO DO: Use :class: screenshot Rendered metric