mirror of
https://github.com/elastic/kibana.git
synced 2025-06-28 11:05:39 -04:00
Modify saved object import APIs to handle special use cases from the previous import process (#34161)
* Modify import APIs to handle special use cases from the previous import process * Cleanup * Add more examples to the docs * Make title come from data inside file * Fix some broken tests * Fix docs * Fix docs wording * Apply PR feedback pt1 * Apply PR feedback pt2
This commit is contained in:
parent
5c2267f2ca
commit
51e6a009ee
22 changed files with 1288 additions and 514 deletions
|
@ -3,7 +3,7 @@
|
|||
|
||||
experimental[This functionality is *experimental* and may be changed or removed completely in a future release.]
|
||||
|
||||
The resolve import errors API enables you to resolve errors given by the import API by either overwriting specific saved objects or changing references to a newly created object.
|
||||
The resolve import errors API enables you to resolve errors given by the import API by either retrying certain saved objects, overwriting specific saved objects or changing references to different saved objects.
|
||||
|
||||
Note: You cannot access this endpoint via the Console in Kibana.
|
||||
|
||||
|
@ -16,27 +16,20 @@ Note: You cannot access this endpoint via the Console in Kibana.
|
|||
The request body must be of type multipart/form-data.
|
||||
|
||||
`file`::
|
||||
(ndjson) The same new line delimited JSON objects given to the import API.
|
||||
The same file given to the import API.
|
||||
|
||||
`overwrites` (optional)::
|
||||
(array) A list of `type` and `id` objects allowed to be overwritten on import.
|
||||
|
||||
`replaceReferences` (optional)::
|
||||
(array) A list of `type`, `from` and `to` used to change imported saved object references to.
|
||||
|
||||
`skips` (optional)::
|
||||
(array) A list of `type` and `id` objects to skip importing.
|
||||
`retries`::
|
||||
(array) A list of `type`, `id`, `replaceReferences` and `overwrite` objects to retry importing. The property `replaceReferences` is a list of `type`, `from` and `to` used to change the object's references.
|
||||
|
||||
==== Response body
|
||||
|
||||
The response body will have a top level `success` property that indicates
|
||||
if the import was successful or not as well as a `successCount` indicating how many records are successfully resolved.
|
||||
In the scenario the import wasn't successful a top level `errors` array will contain the objects that failed to import.
|
||||
if resolving errors was successful or not as well as a `successCount` indicating how many records are successfully resolved.
|
||||
In the scenario resolving errors wasn't successful, a top level `errors` array will contain the objects that failed to be resolved.
|
||||
|
||||
==== Examples
|
||||
|
||||
The following example resolves errors for an index pattern and dashboard but indicates to skip the index pattern.
|
||||
This will cause the index pattern to not be in the system and the dashboard to overwrite the existing saved object.
|
||||
The following example retries importing a dashboard.
|
||||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
|
@ -46,14 +39,9 @@ Content-Type: multipart/form-data; boundary=EXAMPLE
|
|||
Content-Disposition: form-data; name="file"; filename="export.ndjson"
|
||||
Content-Type: application/ndjson
|
||||
|
||||
{"type":"index-pattern","id":"my-pattern","attributes":{"title":"my-pattern-*"}}
|
||||
{"type":"dashboard","id":"my-dashboard","attributes":{"title":"Look at my dashboard"}}
|
||||
--EXAMPLE
|
||||
Content-Disposition: form-data; name="skips"
|
||||
|
||||
[{"type":"index-pattern","id":"my-pattern"}]
|
||||
--EXAMPLE
|
||||
Content-Disposition: form-data; name="overwrites"
|
||||
Content-Disposition: form-data; name="retries"
|
||||
|
||||
[{"type":"dashboard","id":"my-dashboard"}]
|
||||
--EXAMPLE--
|
||||
|
@ -71,8 +59,7 @@ containing a JSON structure similar to the following example:
|
|||
}
|
||||
--------------------------------------------------
|
||||
|
||||
The following example resolves errors for a visualization and dashboard but indicates
|
||||
to replace the dashboard references to another visualization.
|
||||
The following example resolves errors for a dashboard. This will cause the dashboard to overwrite the existing saved object.
|
||||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
|
@ -82,12 +69,42 @@ Content-Type: multipart/form-data; boundary=EXAMPLE
|
|||
Content-Disposition: form-data; name="file"; filename="export.ndjson"
|
||||
Content-Type: application/ndjson
|
||||
|
||||
{"type":"visualization","id":"my-vis","attributes":{"title":"Look at my visualization"}}
|
||||
{"type":"dashboard","id":"my-dashboard","attributes":{"title":"Look at my dashboard"},"references":[{"name":"panel_0","type":"visualization","id":"my-vis"}]}
|
||||
{"type":"index-pattern","id":"my-pattern","attributes":{"title":"my-pattern-*"}}
|
||||
{"type":"dashboard","id":"my-dashboard","attributes":{"title":"Look at my dashboard"}}
|
||||
--EXAMPLE
|
||||
Content-Disposition: form-data; name="replaceReferences"
|
||||
Content-Disposition: form-data; name="retries"
|
||||
|
||||
[{"type":"visualization","from":"my-vis","to":"my-vis-2"}]
|
||||
[{"type":"dashboard","id":"my-dashboard","overwrite":true}]
|
||||
--EXAMPLE--
|
||||
--------------------------------------------------
|
||||
// KIBANA
|
||||
|
||||
A successful call returns a response code of `200` and a response body
|
||||
containing a JSON structure similar to the following example:
|
||||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
{
|
||||
"success": true,
|
||||
"successCount": 1
|
||||
}
|
||||
--------------------------------------------------
|
||||
|
||||
The following example resolves errors for a visualization by replacing the index pattern to another.
|
||||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
POST api/saved_objects/_resolve_import_errors
|
||||
Content-Type: multipart/form-data; boundary=EXAMPLE
|
||||
--EXAMPLE
|
||||
Content-Disposition: form-data; name="file"; filename="export.ndjson"
|
||||
Content-Type: application/ndjson
|
||||
|
||||
{"type":"visualization","id":"my-vis","attributes":{"title":"Look at my visualization"},"references":[{"name":"ref_0","type":"index-pattern","id":"missing"}]}
|
||||
--EXAMPLE
|
||||
Content-Disposition: form-data; name="retries"
|
||||
|
||||
[{"type":"visualization","id":"my-vis","replaceReferences":[{"type":"index-pattern","from":"missing","to":"existing"}]}]
|
||||
--EXAMPLE--
|
||||
--------------------------------------------------
|
||||
// KIBANA
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue