Skip to content

Commit

Permalink
some fixes to expression tutorial (elastic#101558) (elastic#105185)
Browse files Browse the repository at this point in the history
  • Loading branch information
ppisljar authored Jul 12, 2021
1 parent 142cd0c commit c4ce4ef
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions dev_docs/tutorials/expressions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand All @@ -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.

Expand All @@ -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>
Expand All @@ -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>
Expand All @@ -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>
Expand All @@ -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>
Expand All @@ -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>
Expand All @@ -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>

0 comments on commit c4ce4ef

Please sign in to comment.