Skip to content

Commit 936ae05

Browse files
Merge branch 'master' into apm-72636-anomaly-detection-based-alerts
2 parents b1f3b25 + a358c57 commit 936ae05

File tree

759 files changed

+29041
-10431
lines changed

Some content is hidden

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

759 files changed

+29041
-10431
lines changed

.telemetryrc.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
"src/plugins/testbed/",
88
"src/plugins/kibana_utils/",
99
"src/plugins/kibana_usage_collection/server/collectors/kibana/kibana_usage_collector.ts",
10-
"src/plugins/kibana_usage_collection/server/collectors/application_usage/telemetry_application_usage_collector.ts",
1110
"src/plugins/kibana_usage_collection/server/collectors/management/telemetry_management_collector.ts",
1211
"src/plugins/kibana_usage_collection/server/collectors/ui_metric/telemetry_ui_metric_collector.ts",
1312
"src/plugins/telemetry/server/collectors/usage/telemetry_usage_collector.ts"

docs/api/saved-objects/find.asciidoc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,10 @@ experimental[] Retrieve a paginated set of {kib} saved objects by various condit
4444
(Optional, array|string) The fields to return in the `attributes` key of the response.
4545

4646
`sort_field`::
47-
(Optional, string) The field that sorts the response.
47+
(Optional, string) Sorts the response. Includes "root" and "type" fields. "root" fields exist for all saved objects, such as "updated_at".
48+
"type" fields are specific to an object type, such as fields returned in the `attributes` key of the response. When a single type is
49+
defined in the `type` parameter, the "root" and "type" fields are allowed, and validity checks are made in that order. When multiple types
50+
are defined in the `type` parameter, only "root" fields are allowed.
4851

4952
`has_reference`::
5053
(Optional, object) Filters to objects that have a relationship with the type and ID combination.

docs/api/saved-objects/import.asciidoc

Lines changed: 222 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,22 @@ experimental[] Create sets of {kib} saved objects from a file created by the exp
1717
==== Path parameters
1818

1919
`space_id`::
20-
(Optional, string) An identifier for the space. If `space_id` is not provided in the URL, the default space is used.
20+
(Optional, string) An identifier for the <<xpack-spaces,space>>. If `space_id` is not provided in the URL, the default space is used.
2121

2222
[[saved-objects-api-import-query-params]]
2323
==== Query parameters
2424

25+
`createNewCopies`::
26+
(Optional, boolean) Creates copies of saved objects, regenerates each object ID, and resets the origin. When used, potential conflict
27+
errors are avoided.
28+
+
29+
NOTE: This cannot be used with the `overwrite` option.
30+
2531
`overwrite`::
26-
(Optional, boolean) Overwrites saved objects.
32+
(Optional, boolean) Overwrites saved objects when they already exist. When used, potential conflict errors are automatically resolved by
33+
overwriting the destination object.
34+
+
35+
NOTE: This cannot be used with the `createNewCopies` option.
2736

2837
[[saved-objects-api-import-request-body]]
2938
==== Request body
@@ -37,22 +46,88 @@ The request body must include the multipart/form-data type.
3746
==== Response body
3847

3948
`success`::
40-
Top-level property that indicates if the import was successful.
49+
(boolean) Indicates when the import was successfully completed. When set to `false`, some objects may not have been created. For
50+
additional information, refer to the `errors` and `successResults` properties.
4151

4252
`successCount`::
43-
Indicates the number of successfully imported records.
53+
(number) Indicates the number of successfully imported records.
4454

4555
`errors`::
46-
(array) Indicates the import was unsuccessful and specifies the objects that failed to import.
56+
(Optional, array) Indicates the import was unsuccessful and specifies the objects that failed to import.
57+
+
58+
NOTE: One object may result in multiple errors, which requires separate steps to resolve. For instance, a `missing_references` error and
59+
`conflict` error).
60+
61+
`successResults`::
62+
(Optional, array) Indicates the objects that are successfully imported, with any metadata if applicable.
63+
+
64+
NOTE: Objects are only created when all resolvable errors are addressed, including conflicts and missing references. For information on how
65+
to resolve errors, refer to the <<saved-objects-api-import-example,examples>>.
4766

4867
[[saved-objects-api-import-codes]]
4968
==== Response code
5069

5170
`200`::
5271
Indicates a successful call.
5372

73+
[[saved-objects-api-import-example]]
5474
==== Examples
5575

76+
[[saved-objects-api-import-example-1]]
77+
===== Successful import with `createNewCopies` enabled
78+
79+
Import an index pattern and dashboard:
80+
81+
[source,sh]
82+
--------------------------------------------------
83+
$ curl -X POST api/saved_objects/_import?createNewCopies=true -H "kbn-xsrf: true" --form [email protected]
84+
--------------------------------------------------
85+
// KIBANA
86+
87+
The `file.ndjson` file contains the following:
88+
89+
[source,sh]
90+
--------------------------------------------------
91+
{"type":"index-pattern","id":"my-pattern","attributes":{"title":"my-pattern-*"}}
92+
{"type":"dashboard","id":"my-dashboard","attributes":{"title":"Look at my dashboard"}}
93+
--------------------------------------------------
94+
95+
The API returns the following:
96+
97+
[source,sh]
98+
--------------------------------------------------
99+
{
100+
"success": true,
101+
"successCount": 2,
102+
"successResults": [
103+
{
104+
"id": "my-pattern",
105+
"type": "index-pattern",
106+
"destinationId": "4aba3770-0d04-45e1-9e34-4cf0fd2165ae",
107+
"meta": {
108+
"icon": "indexPatternApp",
109+
"title": "my-pattern-*"
110+
}
111+
},
112+
{
113+
"id": "my-dashboard",
114+
"type": "dashboard",
115+
"destinationId": "c31d1eca-9bc0-4a81-b5f9-30c442824c48",
116+
"meta": {
117+
"icon": "dashboardApp",
118+
"title": "Look at my dashboard"
119+
}
120+
}
121+
]
122+
}
123+
--------------------------------------------------
124+
125+
The result indicates a successful import, and both objects are created. Since these objects are created as new copies, each entry in the
126+
`successResults` array includes a `destinationId` attribute.
127+
128+
[[saved-objects-api-import-example-2]]
129+
===== Successful import with `createNewCopies` disabled
130+
56131
Import an index pattern and dashboard:
57132

58133
[source,sh]
@@ -75,11 +150,34 @@ The API returns the following:
75150
--------------------------------------------------
76151
{
77152
"success": true,
78-
"successCount": 2
153+
"successCount": 2,
154+
"successResults": [
155+
{
156+
"id": "my-pattern",
157+
"type": "index-pattern",
158+
"meta": {
159+
"icon": "indexPatternApp",
160+
"title": "my-pattern-*"
161+
}
162+
},
163+
{
164+
"id": "my-dashboard",
165+
"type": "dashboard",
166+
"meta": {
167+
"icon": "dashboardApp",
168+
"title": "Look at my dashboard"
169+
}
170+
}
171+
]
79172
}
80173
--------------------------------------------------
81174

82-
Import an index pattern and dashboard that includes a conflict on the index pattern:
175+
The result indicates a successful import, and both objects are created.
176+
177+
[[saved-objects-api-import-example-3]]
178+
===== Failed import with conflict errors
179+
180+
Import an index pattern, visualization, *Canvas* workpad, and dashboard that include saved objects:
83181

84182
[source,sh]
85183
--------------------------------------------------
@@ -92,6 +190,8 @@ The `file.ndjson` file contains the following:
92190
[source,sh]
93191
--------------------------------------------------
94192
{"type":"index-pattern","id":"my-pattern","attributes":{"title":"my-pattern-*"}}
193+
{"type":"visualization","id":"my-vis","attributes":{"title":"Look at my visualization"}}
194+
{"type":"canvas-workpad","id":"my-canvas","attributes":{"name":"Look at my canvas"}}
95195
{"type":"dashboard","id":"my-dashboard","attributes":{"title":"Look at my dashboard"}}
96196
--------------------------------------------------
97197

@@ -110,12 +210,85 @@ The API returns the following:
110210
"error": {
111211
"type": "conflict"
112212
},
213+
"meta": {
214+
"icon": "indexPatternApp",
215+
"title": "my-pattern-*"
216+
}
217+
},
218+
{
219+
"id": "my-visualization",
220+
"type": "my-vis",
221+
"title": "Look at my visualization",
222+
"error": {
223+
"type": "conflict",
224+
"destinationId": "another-vis"
225+
},
226+
"meta": {
227+
"icon": "visualizeApp",
228+
"title": "Look at my visualization"
229+
}
113230
},
231+
{
232+
"id": "my-canvas",
233+
"type": "canvas-workpad",
234+
"title": "Look at my canvas",
235+
"error": {
236+
"type": "ambiguous_conflict",
237+
"destinations": [
238+
{
239+
"id": "another-canvas",
240+
"title": "Look at another canvas",
241+
"updatedAt": "2020-07-08T16:36:32.377Z"
242+
},
243+
{
244+
"id": "yet-another-canvas",
245+
"title": "Look at yet another canvas",
246+
"updatedAt": "2020-07-05T12:29:54.849Z"
247+
}
248+
]
249+
},
250+
"meta": {
251+
"icon": "canvasApp",
252+
"title": "Look at my canvas"
253+
}
254+
}
114255
],
256+
"successResults": [
257+
{
258+
"id": "my-dashboard",
259+
"type": "dashboard",
260+
"meta": {
261+
"icon": "dashboardApp",
262+
"title": "Look at my dashboard"
263+
}
264+
}
265+
]
115266
}
116267
--------------------------------------------------
117268

118-
Import a visualization and dashboard with an index pattern for the visualization reference that doesn't exist:
269+
The result indicates an unsuccessful import because the index pattern, visualization, *Canvas* workpad, and dashboard resulted in a conflict
270+
error:
271+
272+
* An index pattern with the same ID already exists, which resulted in a conflict error. To resolve the error, overwrite the existing object,
273+
or skip the object.
274+
275+
* A visualization with a different ID, but the same origin already exists, which resulted in a conflict error. The `destinationId` field
276+
contains the `id` of the other visualization, which caused the conflict. The behavior is added to make sure that new objects that can be
277+
shared between <<xpack-spaces,spaces>> behave in a similar way as legacy non-shareable objects. When a shareable object is exported and then
278+
imported into a new space, it retains its origin so that the conflicts are encountered as expected. To resolve, overwrite the specified
279+
destination object, or skip the object.
280+
281+
* Two *Canvas* workpads with different IDs, but the same origin, already exist, which resulted in a conflict error. The `destinations` array
282+
describes the other workpads which caused the conflict. When a shareable object is exported, imported into a new space, then shared to
283+
another space where an object of the same origin exists, the conflict error occurs. To resolve, pick a destination object to overwrite, or
284+
skip the object.
285+
286+
Objects are created when the error is resolved using the <<saved-objects-api-resolve-import-errors-example-1,Resolve import errors API>>.
287+
288+
[[saved-objects-api-import-example-4]]
289+
===== Failed import with missing reference errors
290+
291+
Import a visualization and dashboard when the index pattern for the visualization doesn't exist:
119292

120293
[source,sh]
121294
--------------------------------------------------
@@ -127,36 +300,69 @@ The `file.ndjson` file contains the following:
127300

128301
[source,sh]
129302
--------------------------------------------------
130-
{"type":"visualization","id":"my-vis","attributes":{"title":"my-vis"},"references":[{"name":"ref_0","type":"index-pattern","id":"my-pattern-*"}]}
131-
{"type":"dashboard","id":"my-dashboard","attributes":{"title":"Look at my dashboard"},"references":[{"name":"ref_0","type":"visualization","id":"my-vis"}]}
303+
{"type":"visualization","id":"my-vis","attributes":{"title":"Look at my visualization"},"references":[{"name":"ref_0","type":"index-pattern","id":"my-pattern-*"}]}
304+
{"type":"search","id":"my-search","attributes":{"title":"Look at my search"},"references":[{"name":"ref_0","type":"index-pattern","id":"another-pattern-*"}]}
305+
{"type":"dashboard","id":"my-dashboard","attributes":{"title":"Look at my dashboard"},"references":[{"name":"ref_0","type":"visualization","id":"my-vis"},{"name":"ref_1","type":"search","id":"my-search"}]}
132306
--------------------------------------------------
133307

134308
The API returns the following:
135309

136310
[source,sh]
137311
--------------------------------------------------
312+
{
138313
"success": false,
139-
"successCount": 0,
314+
"successCount": 1,
140315
"errors": [
141316
{
142317
"id": "my-vis",
143318
"type": "visualization",
144-
"title": "my-vis",
319+
"title": "Look at my visualization",
145320
"error": {
146321
"type": "missing_references",
147322
"references": [
148323
{
149324
"type": "index-pattern",
150325
"id": "my-pattern-*"
151326
}
152-
],
153-
"blocking": [
327+
]
328+
},
329+
"meta": {
330+
"icon": "visualizeApp",
331+
"title": "Look at my visualization"
332+
}
333+
},
334+
{
335+
"id": "my-search",
336+
"type": "search",
337+
"title": "Look at my search",
338+
"error": {
339+
"type": "missing_references",
340+
"references": [
154341
{
155-
"type": "dashboard",
156-
"id": "my-dashboard"
342+
"type": "index-pattern",
343+
"id": "another-pattern-*"
157344
}
158345
]
346+
},
347+
"meta": {
348+
"icon": "searchApp",
349+
"title": "Look at my search"
350+
}
351+
}
352+
],
353+
"successResults": [
354+
{
355+
"id": "my-dashboard",
356+
"type": "dashboard",
357+
"meta": {
358+
"icon": "dashboardApp",
359+
"title": "Look at my dashboard"
159360
}
160361
}
161362
]
363+
}
162364
--------------------------------------------------
365+
366+
The result indicates an unsuccessful import because the visualization and search resulted in a missing references error.
367+
368+
Objects are created when the errors are resolved using the <<saved-objects-api-resolve-import-errors-example-2,Resolve import errors API>>.

0 commit comments

Comments
 (0)