Resolve import errors APIedit
[experimental] This functionality is experimental and may be changed or removed completely in a future release. Elastic will take a best effort approach to fix any issues, but experimental features 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
Requestedit
POST /api/saved_objects/_resolve_import_errors
Request bodyedit
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
, andoverwrite
objects to retry. The propertyreplaceReferences
is a list oftype
,from
, andto
used to change the object references.
Response bodyedit
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 codeedit
200
- Indicates a successful call.
Examplesedit
Retry a dashboard import:
$ curl -X POST "localhost:5601/api/saved_objects/_resolve_import_errors" -H "kbn-xsrf: true" --form file=@file.ndjson --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 "localhost:5601/api/saved_objects/_resolve_import_errors" -H "kbn-xsrf: true" --form file=@file.ndjson --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 "localhost:5601/api/saved_objects/_resolve_import_errors" -H "kbn-xsrf: true" --form file=@file.ndjson --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 }