Skip to content

Commit 79f6917

Browse files
Merge branch 'master' into fix/dns_network_query
2 parents d0b282b + d831676 commit 79f6917

File tree

120 files changed

+2244
-1139
lines changed

Some content is hidden

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

120 files changed

+2244
-1139
lines changed

docs/developer/plugin-list.asciidoc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@ allowing users to configure their advanced settings, also known
2828
as uiSettings within the code.
2929
3030
31-
|{kib-repo}blob/{branch}/src/plugins/apm_oss[apmOss]
32-
|WARNING: Missing README.
33-
31+
|{kib-repo}blob/{branch}/src/plugins/apm_oss/README.asciidoc[apmOss]
3432
3533
|{kib-repo}blob/{branch}/src/plugins/bfetch/README.md[bfetch]
3634
|bfetch allows to batch HTTP requests and streams responses back.
-52 KB
Binary file not shown.

docs/management/managing-fields.asciidoc

Lines changed: 19 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,29 @@
11
[[managing-fields]]
2-
== Index patterns and fields
2+
== Field management
33

4-
The *Index patterns* UI helps you create and manage
5-
the index patterns that retrieve your data from {es}.
4+
Whenever possible,
5+
{kib} uses the same field type for display as {es}. However, a few field types
6+
{es} supports are not available in {kib}. Use field formatters to customize how your
7+
fields are displayed in Kibana, regardless of how they are stored in {es}.
68

7-
[role="screenshot"]
8-
image::images/management-index-patterns.png[]
9-
10-
[float]
11-
=== Required permissions
12-
13-
The `Index Pattern Management` {kib} privilege is required to access the *Index patterns* UI.
14-
15-
To add the privilege, open the menu, then click *Stack Management > Roles*.
16-
17-
[float]
18-
=== Create an index pattern
19-
20-
An index pattern is the glue that connects {kib} to your {es} data. Create an
21-
index pattern whenever you load your own data into {kib}. To get started,
22-
click *Create index pattern*, and then follow the guided steps. Refer to
23-
<<index-patterns, Creating an index pattern>> for the types of index patterns
24-
that you can create.
25-
26-
[float]
27-
=== Manage your index pattern
28-
29-
To view the fields and associated data types in an index pattern, click its name in
30-
the *Index patterns* overview.
31-
32-
[role="screenshot"]
33-
image::management/index-patterns/images/new-index-pattern.png["Index files and data types"]
34-
35-
Use the icons to perform the following actions:
9+
Kibana provides these field formatters:
3610

37-
* [[set-default-pattern]]*Set the default index pattern.* {kib} uses a badge to make users
38-
aware of which index pattern is the default. The first pattern
39-
you create is automatically designated as the default pattern. The default
40-
index pattern is loaded when you open *Discover*.
11+
* <<field-formatters-string, Strings>>
12+
* <<field-formatters-date, Dates>>
13+
* <<field-formatters-geopoint, Geopoints>>
14+
* <<field-formatters-numeric, Numbers>>
4115

42-
* *Refresh the index fields list.* You can refresh the index fields list to
43-
pick up any newly-added fields. Doing so also resets the {kib} popularity counters
44-
for the fields. The popularity counters are used in *Discover* to sort fields in lists.
16+
To format a field:
4517

46-
* [[delete-pattern]]*Delete the index pattern.* This action removes the pattern from the list of
47-
Saved Objects in {kib}. You will not be able to recover field formatters,
48-
scripted fields, source filters, and field popularity data associated with the index pattern.
49-
Deleting an index pattern does
50-
not remove any indices or data documents from {es}.
18+
. Open the main menu, and click *Stack Management > Index Patterns*.
19+
. Click the index pattern that contains the field you want to format.
20+
. Find the field you want to format and click the edit icon (image:management/index-patterns/images/edit_icon.png[]).
21+
. Select a format and fill in the details.
5122
+
52-
WARNING: Deleting an index pattern breaks all visualizations, saved searches, and
53-
other saved objects that reference the pattern.
54-
55-
[float]
56-
=== Edit a field
57-
58-
To edit a field's properties, click the edit icon
59-
image:management/index-patterns/images/edit_icon.png[] in the detail view.
60-
You can set the field's format and popularity value.
23+
[role="screenshot"]
24+
image:management/index-patterns/images/edit-field-format.png["Edit field format"]
6125

62-
Kibana has field formatters for the following field types:
6326

64-
* <<field-formatters-string, Strings>>
65-
* <<field-formatters-date, Dates>>
66-
* <<field-formatters-geopoint, Geopoints>>
67-
* <<field-formatters-numeric, Numbers>>
6827

6928
[[field-formatters-string]]
7029
=== String field formatters
@@ -121,12 +80,8 @@ WARNING: Computing data on the fly with scripted fields can be very resource int
12180
{kib} performance. Keep in mind that there's no built-in validation of a scripted field. If your scripts are
12281
buggy, you'll get exceptions whenever you try to view the dynamically generated data.
12382

124-
When you define a scripted field in {kib}, you have a choice of scripting languages. In 5.0 and later, the default
125-
options are {ref}/modules-scripting-expression.html[Lucene expressions] and {ref}/modules-scripting-painless.html[Painless].
126-
While you can use other scripting languages if you enable dynamic scripting for them in {es}, this is not recommended
127-
because they cannot be sufficiently {ref}/modules-scripting-security.html[sandboxed].
128-
129-
WARNING: In 5.0 and later, Groovy, JavaScript, and Python scripting are deprecated and unsupported.
83+
When you define a scripted field in {kib}, you have a choice of the {ref}/modules-scripting-expression.html[Lucene expressions] or the
84+
{ref}/modules-scripting-painless.html[Painless] scripting language.
13085

13186
You can reference any single value numeric field in your expressions, for example:
13287

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@
567567
"@types/zen-observable": "^0.8.0",
568568
"@typescript-eslint/eslint-plugin": "^3.10.0",
569569
"@typescript-eslint/parser": "^3.10.0",
570-
"@welldone-software/why-did-you-render": "^4.0.0",
570+
"@welldone-software/why-did-you-render": "^5.0.0",
571571
"@yarnpkg/lockfile": "^1.1.0",
572572
"abab": "^1.0.4",
573573
"angular-aria": "^1.8.0",

rfcs/text/0013_saved_object_migrations.md

Lines changed: 41 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -212,39 +212,68 @@ Note:
212212
If none of the aliases exists, this is a new Elasticsearch cluster and no
213213
migrations are necessary. Create the `.kibana_7.10.0_001` index with the
214214
following aliases: `.kibana_current` and `.kibana_7.10.0`.
215-
2. If `.kibana_current` and `.kibana_7.10.0` both exists and are pointing to the same index this version's migration has already been completed.
215+
2. If the source is a < v6.5 `.kibana` index or < 7.4 `.kibana_task_manager`
216+
index prepare the legacy index for a migration:
217+
1. Mark the legacy index as read-only and wait for all in-flight operations to drain (requires https://github.com/elastic/elasticsearch/pull/58094). This prevents any further writes from outdated nodes. Assuming this API is similar to the existing `/<index>/_close` API, we expect to receive `"acknowledged" : true` and `"shards_acknowledged" : true`. If all shards don’t acknowledge within the timeout, retry the operation until it succeeds.
218+
2. Clone the legacy index into a new index which has writes enabled. Use a fixed index name i.e `.kibana_pre6.5.0_001` or `.kibana_task_manager_pre7.4.0_001`. `POST /.kibana/_clone/.kibana_pre6.5.0_001?wait_for_active_shards=all {"settings": {"index.blocks.write": false}}`. Ignore errors if the clone already exists. Ignore errors if the legacy source doesn't exist.
219+
3. Wait for the cloning to complete `GET /_cluster/health/.kibana_pre6.5.0_001?wait_for_status=green&timeout=60s` If cloning doesn’t complete within the 60s timeout, log a warning for visibility and poll again.
220+
4. Apply the `convertToAlias` script if defined `POST /.kibana_pre6.5.0_001/_update_by_query?conflicts=proceed {"script": {...}}`. The `convertToAlias` script will have to be idempotent, preferably setting `ctx.op="noop"` on subsequent runs to avoid unecessary writes.
221+
5. Delete the legacy index and replace it with an alias of the same name
222+
```
223+
POST /_aliases
224+
{
225+
"actions" : [
226+
{ "add": { "index": ".kibana_pre6.5.0_001", "alias": ".kibana" } },
227+
{ "remove_index": { "index": ".kibana" } }
228+
]
229+
}
230+
```.
231+
Unlike the delete index API, the `remove_index` action will fail if
232+
provided with an _alias_. Ignore "The provided expression [.kibana]
233+
matches an alias, specify the corresponding concrete indices instead."
234+
or "index_not_found_exception" errors. These actions are applied
235+
atomically so that other Kibana instances will always see either a
236+
`.kibana` index or an alias, but never neither.
237+
6. Use the cloned `.kibana_pre6.5.0_001` as the source for the rest of the migration algorithm.
238+
3. If `.kibana_current` and `.kibana_7.10.0` both exists and are pointing to the same index this version's migration has already been completed.
216239
1. Because the same version can have plugins enabled at any point in time,
217240
perform the mappings update in step (6) and migrate outdated documents
218241
with step (7).
219242
2. Skip to step (9) to start serving traffic.
220-
3. Fail the migration if:
243+
4. Fail the migration if:
221244
1. `.kibana_current` is pointing to an index that belongs to a later version of Kibana .e.g. `.kibana_7.12.0_001`
222245
2. (Only in 8.x) The source index contains documents that belong to an unknown Saved Object type (from a disabled plugin). Log an error explaining that the plugin that created these documents needs to be enabled again or that these objects should be deleted. See section (4.2.1.4).
223-
4. Mark the source index as read-only and wait for all in-flight operations to drain (requires https://github.com/elastic/elasticsearch/pull/58094). This prevents any further writes from outdated nodes. Assuming this API is similar to the existing `/<index>/_close` API, we expect to receive `"acknowledged" : true` and `"shards_acknowledged" : true`. If all shards don’t acknowledge within the timeout, retry the operation until it succeeds.
224-
5. Clone the source index into a new target index which has writes enabled. All nodes on the same version will use the same fixed index name e.g. `.kibana_7.10.0_001`. The `001` postfix isn't used by Kibana, but allows for re-indexing an index should this be required by an Elasticsearch upgrade. E.g. re-index `.kibana_7.10.0_001` into `.kibana_7.10.0_002` and point the `.kibana_7.10.0` alias to `.kibana_7.10.0_002`.
246+
5. Mark the source index as read-only and wait for all in-flight operations to drain (requires https://github.com/elastic/elasticsearch/pull/58094). This prevents any further writes from outdated nodes. Assuming this API is similar to the existing `/<index>/_close` API, we expect to receive `"acknowledged" : true` and `"shards_acknowledged" : true`. If all shards don’t acknowledge within the timeout, retry the operation until it succeeds.
247+
6. Clone the source index into a new target index which has writes enabled. All nodes on the same version will use the same fixed index name e.g. `.kibana_7.10.0_001`. The `001` postfix isn't used by Kibana, but allows for re-indexing an index should this be required by an Elasticsearch upgrade. E.g. re-index `.kibana_7.10.0_001` into `.kibana_7.10.0_002` and point the `.kibana_7.10.0` alias to `.kibana_7.10.0_002`.
225248
1. `POST /.kibana_n/_clone/.kibana_7.10.0_001?wait_for_active_shards=all {"settings": {"index.blocks.write": false}}`. Ignore errors if the clone already exists.
226249
2. Wait for the cloning to complete `GET /_cluster/health/.kibana_7.10.0_001?wait_for_status=green&timeout=60s` If cloning doesn’t complete within the 60s timeout, log a warning for visibility and poll again.
227-
6. Update the mappings of the target index
250+
7. Update the mappings of the target index
228251
1. Retrieve the existing mappings including the `migrationMappingPropertyHashes` metadata.
229252
2. Update the mappings with `PUT /.kibana_7.10.0_001/_mapping`. The API deeply merges any updates so this won't remove the mappings of any plugins that were enabled in a previous version but are now disabled.
230253
3. Ensure that fields are correctly indexed using the target index's latest mappings `POST /.kibana_7.10.0_001/_update_by_query?conflicts=proceed`. In the future we could optimize this query by only targeting documents:
231254
1. That belong to a known saved object type.
232255
2. Which don't have outdated migrationVersion numbers since these will be transformed anyway.
233256
3. That belong to a type whose mappings were changed by comparing the `migrationMappingPropertyHashes`. (Metadata, unlike the mappings isn't commutative, so there is a small chance that the metadata hashes do not accurately reflect the latest mappings, however, this will just result in an less efficient query).
234-
7. Transform documents by reading batches of outdated documents from the target index then transforming and updating them with optimistic concurrency control.
257+
8. Transform documents by reading batches of outdated documents from the target index then transforming and updating them with optimistic concurrency control.
235258
1. Ignore any version conflict errors.
236259
2. If a document transform throws an exception, add the document to a failure list and continue trying to transform all other documents. If any failures occured, log the complete list of documents that failed to transform. Fail the migration.
237-
8. Mark the migration as complete by doing a single atomic operation (requires https://github.com/elastic/elasticsearch/pull/58100) that:
238-
1. Checks that `.kibana-current` alias is still pointing to the source index
239-
2. Points the `.kibana-7.10.0` and `.kibana_current` aliases to the target index.
240-
3. If this fails with a "required alias [.kibana_current] does not exist" error fetch `.kibana_current` again:
260+
9. Mark the migration as complete by doing a single atomic operation (requires https://github.com/elastic/elasticsearch/pull/58100) that:
261+
3. Checks that `.kibana_current` alias is still pointing to the source index
262+
4. Points the `.kibana_7.10.0` and `.kibana_current` aliases to the target index.
263+
5. If this fails with a "required alias [.kibana_current] does not exist" error fetch `.kibana_current` again:
241264
1. If `.kibana_current` is _not_ pointing to our target index fail the migration.
242265
2. If `.kibana_current` is pointing to our target index the migration has succeeded and we can proceed to step (9).
243-
9. Start serving traffic.
266+
10. Start serving traffic.
267+
268+
This algorithm shares a weakness with our existing migration algorithm
269+
(since v7.4). When the task manager index gets reindexed a reindex script is
270+
applied. Because we delete the original task manager index there is no way to
271+
rollback a failed task manager migration without a snapshot.
244272
245273
Together with the limitations, this algorithm ensures that migrations are
246274
idempotent. If two nodes are started simultaneously, both of them will start
247-
transforming documents in that version's target index, but because migrations are idempotent, it doesn’t matter which node’s writes win.
275+
transforming documents in that version's target index, but because migrations
276+
are idempotent, it doesn’t matter which node’s writes win.
248277
249278
<details>
250279
<summary>In the future, this algorithm could enable (2.6) "read-only functionality during the downtime window" but this is outside of the scope of this RFC.</summary>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# APM OSS plugin
2+
3+
OSS plugin for APM. Includes index configuration and tutorial resources.
4+
5+
See <<../../x-pack/plugins/apm/readme.md,the X-Pack APM plugin README>> for information about the main APM plugin.

src/plugins/dashboard/public/application/actions/add_to_library_action.test.tsx

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -134,19 +134,15 @@ test('Add to library is not compatible when embeddable is not in a dashboard con
134134
expect(await action.isCompatible({ embeddable: orphanContactCard })).toBe(false);
135135
});
136136

137-
test('Add to library replaces embeddableId but retains panel count', async () => {
137+
test('Add to library replaces embeddableId and retains panel count', async () => {
138138
const dashboard = embeddable.getRoot() as IContainer;
139139
const originalPanelCount = Object.keys(dashboard.getInput().panels).length;
140-
const originalPanelKeySet = new Set(Object.keys(dashboard.getInput().panels));
140+
141141
const action = new AddToLibraryAction({ toasts: coreStart.notifications.toasts });
142142
await action.execute({ embeddable });
143143
expect(Object.keys(container.getInput().panels).length).toEqual(originalPanelCount);
144-
145-
const newPanelId = Object.keys(container.getInput().panels).find(
146-
(key) => !originalPanelKeySet.has(key)
147-
);
148-
expect(newPanelId).toBeDefined();
149-
const newPanel = container.getInput().panels[newPanelId!];
144+
expect(Object.keys(container.getInput().panels)).toContain(embeddable.id);
145+
const newPanel = container.getInput().panels[embeddable.id!];
150146
expect(newPanel.type).toEqual(embeddable.type);
151147
});
152148

@@ -162,15 +158,10 @@ test('Add to library returns reference type input', async () => {
162158
mockedByReferenceInput: { savedObjectId: 'testSavedObjectId', id: embeddable.id },
163159
mockedByValueInput: { attributes: complicatedAttributes, id: embeddable.id } as EmbeddableInput,
164160
});
165-
const dashboard = embeddable.getRoot() as IContainer;
166-
const originalPanelKeySet = new Set(Object.keys(dashboard.getInput().panels));
167161
const action = new AddToLibraryAction({ toasts: coreStart.notifications.toasts });
168162
await action.execute({ embeddable });
169-
const newPanelId = Object.keys(container.getInput().panels).find(
170-
(key) => !originalPanelKeySet.has(key)
171-
);
172-
expect(newPanelId).toBeDefined();
173-
const newPanel = container.getInput().panels[newPanelId!];
163+
expect(Object.keys(container.getInput().panels)).toContain(embeddable.id);
164+
const newPanel = container.getInput().panels[embeddable.id!];
174165
expect(newPanel.type).toEqual(embeddable.type);
175166
expect(newPanel.explicitInput.attributes).toBeUndefined();
176167
expect(newPanel.explicitInput.savedObjectId).toBe('testSavedObjectId');

src/plugins/dashboard/public/application/actions/clone_panel_action.test.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,12 @@ test('Clone adds a new embeddable', async () => {
108108
);
109109
expect(newPanelId).toBeDefined();
110110
const newPanel = container.getInput().panels[newPanelId!];
111-
expect(newPanel.type).toEqual(embeddable.type);
111+
expect(newPanel.type).toEqual('placeholder');
112+
// let the placeholder load
113+
await dashboard.untilEmbeddableLoaded(newPanelId!);
114+
// now wait for the full embeddable to replace it
115+
const loadedPanel = await dashboard.untilEmbeddableLoaded(newPanelId!);
116+
expect(loadedPanel.type).toEqual(embeddable.type);
112117
});
113118

114119
test('Clones an embeddable without a saved object ID', async () => {

src/plugins/dashboard/public/application/actions/unlink_from_library_action.test.tsx

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -132,19 +132,14 @@ test('Unlink is not compatible when embeddable is not in a dashboard container',
132132
expect(await action.isCompatible({ embeddable: orphanContactCard })).toBe(false);
133133
});
134134

135-
test('Unlink replaces embeddableId but retains panel count', async () => {
135+
test('Unlink replaces embeddableId and retains panel count', async () => {
136136
const dashboard = embeddable.getRoot() as IContainer;
137137
const originalPanelCount = Object.keys(dashboard.getInput().panels).length;
138-
const originalPanelKeySet = new Set(Object.keys(dashboard.getInput().panels));
139138
const action = new UnlinkFromLibraryAction({ toasts: coreStart.notifications.toasts });
140139
await action.execute({ embeddable });
141140
expect(Object.keys(container.getInput().panels).length).toEqual(originalPanelCount);
142-
143-
const newPanelId = Object.keys(container.getInput().panels).find(
144-
(key) => !originalPanelKeySet.has(key)
145-
);
146-
expect(newPanelId).toBeDefined();
147-
const newPanel = container.getInput().panels[newPanelId!];
141+
expect(Object.keys(container.getInput().panels)).toContain(embeddable.id);
142+
const newPanel = container.getInput().panels[embeddable.id!];
148143
expect(newPanel.type).toEqual(embeddable.type);
149144
});
150145

@@ -164,15 +159,10 @@ test('Unlink unwraps all attributes from savedObject', async () => {
164159
mockedByReferenceInput: { savedObjectId: 'testSavedObjectId', id: embeddable.id },
165160
mockedByValueInput: { attributes: complicatedAttributes, id: embeddable.id },
166161
});
167-
const dashboard = embeddable.getRoot() as IContainer;
168-
const originalPanelKeySet = new Set(Object.keys(dashboard.getInput().panels));
169162
const action = new UnlinkFromLibraryAction({ toasts: coreStart.notifications.toasts });
170163
await action.execute({ embeddable });
171-
const newPanelId = Object.keys(container.getInput().panels).find(
172-
(key) => !originalPanelKeySet.has(key)
173-
);
174-
expect(newPanelId).toBeDefined();
175-
const newPanel = container.getInput().panels[newPanelId!];
164+
expect(Object.keys(container.getInput().panels)).toContain(embeddable.id);
165+
const newPanel = container.getInput().panels[embeddable.id!];
176166
expect(newPanel.type).toEqual(embeddable.type);
177167
expect(newPanel.explicitInput.attributes).toEqual(complicatedAttributes);
178168
});

0 commit comments

Comments
 (0)