Resolve import errors API

edit

Resolve import errors API

edit

[preview] This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features. Resolve errors from the import API.

To resolve errors, you can:

  • Retry certain saved objects
  • Overwrite specific saved objects
  • Change references to different saved objects

Request

edit

POST <kibana host>:<port>/api/saved_objects/_resolve_import_errors

POST <kibana host>:<port>/s/<space_id>/api/saved_objects/_resolve_import_errors

Path parameters

edit
space_id
(Optional, string) An identifier for the space. If space_id is not provided in the URL, the default space is used.

Request body

edit

The request body must include the multipart/form-data type.

file
The same file given to the import API.
retries
(array) A list of type, id, replaceReferences, and overwrite objects to retry. The property replaceReferences is a list of type, from, and to used to change the object references.

Response body

edit
success
Top-level property that indicates if the errors successfully resolved.
successCount
Indicates the number of successfully resolved records.
errors
(array) Specifies the objects that failed to resolve.

Response code

edit
200
Indicates a successful call.

Examples

edit

Retry a dashboard import:

$ curl -X POST api/saved_objects/_resolve_import_errors -H "kbn-xsrf: true" --form [email protected] --form retries='[{"type":"dashboard","id":"my-dashboard"}]'

The file.ndjson file contains the following:

{"type":"dashboard","id":"my-dashboard","attributes":{"title":"Look at my dashboard"}}

The API returns the following:

{
  "success": true,
  "successCount": 1
}

Resolve errors for a dashboard and overwrite the existing saved object:

$ curl -X POST api/saved_objects/_resolve_import_errors -H "kbn-xsrf: true" --form [email protected] --form retries='[{"type":"dashboard","id":"my-dashboard","overwrite":true}]'

The file.ndjson file contains the following:

{"type":"index-pattern","id":"my-pattern","attributes":{"title":"my-pattern-*"}}
{"type":"dashboard","id":"my-dashboard","attributes":{"title":"Look at my dashboard"}}

The API returns the following:

{
  "success": true,
  "successCount": 1
}

Resolve errors for a visualization by replacing the index pattern with another:

$ curl -X POST api/saved_objects/_resolve_import_errors -H "kbn-xsrf: true" --form [email protected] --form retries='[{"type":"visualization","id":"my-vis","replaceReferences":[{"type":"index-pattern","from":"missing","to":"existing"}]}]'

The file.ndjson file contains the following:

{"type":"visualization","id":"my-vis","attributes":{"title":"Look at my visualization"},"references":[{"name":"ref_0","type":"index-pattern","id":"missing"}]}

The API returns the following:

{
  "success": true,
  "successCount": 1
}