parent
142cd0ca57
commit
c4ce4ef134
|
@ -10,10 +10,12 @@ tags: ['kibana', 'onboarding', 'dev', 'architecture']
|
|||
## Expressions service
|
||||
|
||||
Expression service exposes a registry of reusable functions primary used for fetching and transposing data and a registry of renderer functions that can render data into a DOM element.
|
||||
Adding functions is easy and so is reusing them. An expression is a chain of functions with provided arguments, which given a single input translates to a single output.
|
||||
Adding functions is easy and so is reusing them.
|
||||
|
||||
An expression is a chain of functions with provided arguments, which given a single input translates to a single output.
|
||||
Each expression is representable by a human friendly string which a user can type.
|
||||
|
||||
### creating expressions
|
||||
### Creating expressions
|
||||
|
||||
Here is a very simple expression string:
|
||||
|
||||
|
@ -23,7 +25,7 @@ essql 'select column1, column2 from myindex' | mapColumn name=column3 fn='{ colu
|
|||
|
||||
It consists of 3 functions:
|
||||
|
||||
- essql which runs given sql query against elasticsearch and returns the results
|
||||
- `essql` which runs given sql query against elasticsearch and returns the results
|
||||
- `mapColumn`, which computes a new column from existing ones;
|
||||
- `table`, which prepares the data for rendering in a tabular format.
|
||||
|
||||
|
@ -41,7 +43,7 @@ const expression = buildExpression([
|
|||
|
||||
Note: Consumers need to be aware which plugin registers specific functions with expressions function registry and import correct type definitions from there.
|
||||
|
||||
<DocCallOut title="Server Side Search">
|
||||
<DocCallOut>
|
||||
The `expressions` service is available on both server and client, with similar APIs.
|
||||
</DocCallOut>
|
||||
|
||||
|
@ -54,7 +56,7 @@ const executionContract = expressions.execute(expression, input);
|
|||
const result = await executionContract.getData();
|
||||
```
|
||||
|
||||
<DocCallOut title="Server Side Search">
|
||||
<DocCallOut>
|
||||
Check the full spec of execute function [here](https://github.com/elastic/kibana/blob/master/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.execution.md)
|
||||
</DocCallOut>
|
||||
|
||||
|
@ -68,7 +70,7 @@ This is the easiest way to get expressions rendered inside your application.
|
|||
<ReactExpressionRenderer expression={expression} />
|
||||
```
|
||||
|
||||
<DocCallOut title="Server Side Search">
|
||||
<DocCallOut>
|
||||
Check the full spec of ReactExpressionRenderer component props [here](https://github.com/elastic/kibana/blob/master/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.reactexpressionrendererprops.md)
|
||||
</DocCallOut>
|
||||
|
||||
|
@ -80,7 +82,7 @@ If you are not using React, you can use the loader expression service provides t
|
|||
const handler = loader(domElement, expression, params);
|
||||
```
|
||||
|
||||
<DocCallOut title="Server Side Search">
|
||||
<DocCallOut>
|
||||
Check the full spec of expression loader params [here](https://github.com/elastic/kibana/blob/master/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.iexpressionloaderparams.md)
|
||||
</DocCallOut>
|
||||
|
||||
|
@ -103,7 +105,7 @@ const functionDefinition = {
|
|||
expressions.registerFunction(functionDefinition);
|
||||
```
|
||||
|
||||
<DocCallOut title="Server Side Search">
|
||||
<DocCallOut>
|
||||
Check the full interface of ExpressionFuntionDefinition [here](https://github.com/elastic/kibana/blob/master/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionfunctiondefinition.md)
|
||||
</DocCallOut>
|
||||
|
||||
|
@ -125,6 +127,6 @@ const rendererDefinition = {
|
|||
expressions.registerRenderer(rendererDefinition);
|
||||
```
|
||||
|
||||
<DocCallOut title="Server Side Search">
|
||||
<DocCallOut>
|
||||
Check the full interface of ExpressionRendererDefinition [here](https://github.com/elastic/kibana/blob/master/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionrenderdefinition.md)
|
||||
</DocCallOut>
|
||||
|
|
Loading…
Reference in a new issue