Skip to content

Commit ce7e4d2

Browse files
Merge branch 'master' into reporting/prevent-sending-telemetry
2 parents f00a895 + 4aa3920 commit ce7e4d2

161 files changed

Lines changed: 4392 additions & 1046 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.i18nrc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"console": "src/plugins/console",
44
"core": "src/core",
55
"discover": "src/plugins/discover",
6+
"bfetch": "src/plugins/bfetch",
67
"dashboard": "src/plugins/dashboard",
78
"data": "src/plugins/data",
89
"embeddableApi": "src/plugins/embeddable",

dev_docs/tutorials/expressions.mdx

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
---
2+
id: kibDevTutorialExpressions
3+
slug: /kibana-dev-docs/tutorials/expressions
4+
title: Kibana Expressions Service
5+
summary: Kibana Expressions Service
6+
date: 2021-06-01
7+
tags: ['kibana', 'onboarding', 'dev', 'architecture']
8+
---
9+
10+
## Expressions service
11+
12+
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.
13+
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.
14+
Each expression is representable by a human friendly string which a user can type.
15+
16+
### creating expressions
17+
18+
Here is a very simple expression string:
19+
20+
essql 'select column1, column2 from myindex' | mapColumn name=column3 fn='{ column1 + 3 }' | table
21+
22+
23+
It consists of 3 functions:
24+
25+
- essql which runs given sql query against elasticsearch and returns the results
26+
- `mapColumn`, which computes a new column from existing ones;
27+
- `table`, which prepares the data for rendering in a tabular format.
28+
29+
The same expression could also be constructed in the code:
30+
31+
```ts
32+
import { buildExpression, buildExpressionFunction } from 'src/plugins/expressions';
33+
34+
const expression = buildExpression([
35+
buildExpressionFunction<ExpressionFunctionEssql>('essql', [ q: 'select column1, column2 from myindex' ]),
36+
buildExpressionFunction<ExpressionFunctionMapColumn>('mapColumn', [ name: 'column3', expression: 'column1 + 3' ]),
37+
buildExpressionFunction<ExpressionFunctionTable>('table'),
38+
]
39+
```
40+
41+
Note: Consumers need to be aware which plugin registers specific functions with expressions function registry and import correct type definitions from there.
42+
43+
<DocCallOut title="Server Side Search">
44+
The `expressions` service is available on both server and client, with similar APIs.
45+
</DocCallOut>
46+
47+
### Running expressions
48+
49+
Expression service exposes `execute` method which allows you to execute an expression:
50+
51+
```ts
52+
const executionContract = expressions.execute(expression, input);
53+
const result = await executionContract.getData();
54+
```
55+
56+
<DocCallOut title="Server Side Search">
57+
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)
58+
</DocCallOut>
59+
60+
In addition, on the browser side, there are two additional ways to run expressions and render the results.
61+
62+
#### React expression renderer component
63+
64+
This is the easiest way to get expressions rendered inside your application.
65+
66+
```ts
67+
<ReactExpressionRenderer expression={expression} />
68+
```
69+
70+
<DocCallOut title="Server Side Search">
71+
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)
72+
</DocCallOut>
73+
74+
#### Expression loader
75+
76+
If you are not using React, you can use the loader expression service provides to achieve the same:
77+
78+
```ts
79+
const handler = loader(domElement, expression, params);
80+
```
81+
82+
<DocCallOut title="Server Side Search">
83+
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)
84+
</DocCallOut>
85+
86+
### Creating new expression functions
87+
88+
Creating a new expression function is easy, just call `registerFunction` method on expressions service setup contract with your function definition:
89+
90+
```ts
91+
const functionDefinition = {
92+
name: 'clog',
93+
args: {},
94+
help: 'Outputs the context to the console',
95+
fn: (input: unknown) => {
96+
// eslint-disable-next-line no-console
97+
console.log(input);
98+
return input;
99+
},
100+
};
101+
102+
expressions.registerFunction(functionDefinition);
103+
```
104+
105+
<DocCallOut title="Server Side Search">
106+
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)
107+
</DocCallOut>
108+
109+
### Creating new expression renderers
110+
111+
Adding new renderers is just as easy as adding functions:
112+
113+
```ts
114+
const rendererDefinition = {
115+
name: 'debug',
116+
help: 'Outputs the context to the dom element',
117+
render: (domElement, input, handlers) => {
118+
// eslint-disable-next-line no-console
119+
domElement.innerText = JSON.strinfigy(input);
120+
handlers.done();
121+
},
122+
};
123+
124+
expressions.registerRenderer(rendererDefinition);
125+
```
126+
127+
<DocCallOut title="Server Side Search">
128+
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)
129+
</DocCallOut>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [DeprecationsDetails](./kibana-plugin-core-server.deprecationsdetails.md) &gt; [deprecationType](./kibana-plugin-core-server.deprecationsdetails.deprecationtype.md)
4+
5+
## DeprecationsDetails.deprecationType property
6+
7+
(optional) Used to identify between different deprecation types. Example use case: in Upgrade Assistant, we may want to allow the user to sort by deprecation type or show each type in a separate tab.
8+
9+
Feel free to add new types if necessary. Predefined types are necessary to reduce having similar definitions with different keywords across kibana deprecations.
10+
11+
<b>Signature:</b>
12+
13+
```typescript
14+
deprecationType?: 'config' | 'feature';
15+
```

docs/development/core/server/kibana-plugin-core-server.deprecationsdetails.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export interface DeprecationsDetails
1515
| Property | Type | Description |
1616
| --- | --- | --- |
1717
| [correctiveActions](./kibana-plugin-core-server.deprecationsdetails.correctiveactions.md) | <code>{</code><br/><code> api?: {</code><br/><code> path: string;</code><br/><code> method: 'POST' &#124; 'PUT';</code><br/><code> body?: {</code><br/><code> [key: string]: any;</code><br/><code> };</code><br/><code> };</code><br/><code> manualSteps?: string[];</code><br/><code> }</code> | |
18+
| [deprecationType](./kibana-plugin-core-server.deprecationsdetails.deprecationtype.md) | <code>'config' &#124; 'feature'</code> | (optional) Used to identify between different deprecation types. Example use case: in Upgrade Assistant, we may want to allow the user to sort by deprecation type or show each type in a separate tab.<!-- -->Feel free to add new types if necessary. Predefined types are necessary to reduce having similar definitions with different keywords across kibana deprecations. |
1819
| [documentationUrl](./kibana-plugin-core-server.deprecationsdetails.documentationurl.md) | <code>string</code> | |
1920
| [level](./kibana-plugin-core-server.deprecationsdetails.level.md) | <code>'warning' &#124; 'critical' &#124; 'fetch_error'</code> | levels: - warning: will not break deployment upon upgrade - critical: needs to be addressed before upgrade. - fetch\_error: Deprecations service failed to grab the deprecation details for the domain. |
2021
| [message](./kibana-plugin-core-server.deprecationsdetails.message.md) | <code>string</code> | |
45.3 KB
Loading

docs/user/dashboard/lens.asciidoc

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,8 @@ A subset of *Lens* visualizations support value labels.
190190
[role="screenshot"]
191191
image::images/lens_value_labels_xychart_toggle.png[Lens Bar chart value labels menu]
192192

193+
NOTE: In bar charts, you are unable to move the label positions.
194+
193195
* *Pie*, *Donut*, and *Treemap*
194196
+
195197
[role="screenshot"]
@@ -243,6 +245,9 @@ refer to <<explore-fields-in-your-data,Explore the fields in your data>>.
243245

244246
Sorting dimensions in visualizations is unsupported in *Lens*.
245247

248+
You can sort the dimensions for a single column in data tables: click the column header, then select the sorting criteria you want to use.
249+
If you use the dimension as `Columns`, then all the columns that belong to the same dimension are sorted in the table.
250+
246251
[float]
247252
[[is-it-possible-to-use-saved-serches-in-lens]]
248253
===== How do I visualize saved searches?
@@ -254,3 +259,47 @@ Visualizing saved searches in unsupported in *Lens*.
254259
===== How do I change the number of suggestions?
255260

256261
Configuring the *Suggestions* that *Lens* automatically populates is unsupported.
262+
263+
[float]
264+
[[is-it-possible-to-use-different-indexpatterns-in-lens]]
265+
===== Can I visualize multiple index patterns in a single visualization?
266+
267+
You can create *Bar*, *Line* and *Area* charts from multiple index patterns.
268+
269+
Each *Layer* in a visualization is associated with an index pattern and mutiple *Layers* can be combined together within the same visualization. Each *Layer* also has a chart switcher button in order to select the best type of visualization for the specific dataset.
270+
You can also change the index pattern for a single *Layer*.
271+
272+
[float]
273+
[[why-my-field-x-is-missing-from-the-fields-list]]
274+
===== Why is my field X missing from the fields list?
275+
276+
*Lens* does not support the visualization of full-text fields, therefore it is not showing them in the data summary.
277+
278+
[float]
279+
[[how-to-handle-gaps-in-time-series-visualizations]]
280+
===== How do I handle gaps in time series visualizations?
281+
282+
*Lens* provides a set of features to handle missing values for *Area* and *Line* charts, which is useful for sparse data in time series data.
283+
284+
To select a different way to represent missing values, open the *Visual options* menu, then select how to handle missing values. The default is to hide the missing values.
285+
+
286+
[role="screenshot"]
287+
image::images/lens_missing_values_strategy.png[Lens Missing values strategies menu]
288+
289+
[float]
290+
[[is-it-possible-to-change-the-scale-of-Y-axis]]
291+
===== Is it possible to statically define the scale of the y-axis in a visualization?
292+
293+
The ability to start the y-axis from another value than 0, or use a logarithmic scale, is unsupported in *Lens*.
294+
295+
[float]
296+
[[is-it-possible-to-have-pagination-for-datatable]]
297+
===== Is it possible to have pagination in a data table?
298+
299+
Pagination in a data table is unsupported in *Lens*. However, the <<types-of-visualizations,aggregation-based data table>> supports pagination.
300+
301+
[float]
302+
[[is-it-possible-to-have-more-than-one-Y-axis-scale]]
303+
===== Is it possible to have more than one y-axis scale in visualizations?
304+
305+
*Lens* lets you pick, for each Y dimension, up to two distinct axis: *left* and *right*. Each axis can have a different scale.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@
229229
"expiry-js": "0.1.7",
230230
"extract-zip": "^2.0.1",
231231
"fast-deep-equal": "^3.1.1",
232+
"fflate": "^0.6.9",
232233
"file-saver": "^1.3.8",
233234
"file-type": "^10.9.0",
234235
"focus-trap-react": "^3.1.1",

packages/kbn-optimizer/limits.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ pageLoadAssetSize:
33
alerting: 106936
44
apm: 64385
55
apmOss: 18996
6-
bfetch: 41874
6+
bfetch: 51874
77
canvas: 1066647
88
charts: 195358
99
cloud: 21076

packages/kbn-ui-shared-deps/entry.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ export const Theme = require('./theme.ts');
4444
export const Lodash = require('lodash');
4545
export const LodashFp = require('lodash/fp');
4646

47+
export const Fflate = require('fflate/esm/browser');
48+
4749
// runtime deps which don't need to be copied across all bundles
4850
export const TsLib = require('tslib');
4951
export const KbnAnalytics = require('@kbn/analytics');

packages/kbn-ui-shared-deps/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ exports.externals = {
5252
'@elastic/eui/dist/eui_theme_dark.json': '__kbnSharedDeps__.Theme.euiDarkVars',
5353
lodash: '__kbnSharedDeps__.Lodash',
5454
'lodash/fp': '__kbnSharedDeps__.LodashFp',
55+
fflate: '__kbnSharedDeps__.Fflate',
5556

5657
/**
5758
* runtime deps which don't need to be copied across all bundles

0 commit comments

Comments
 (0)