Import Objects
editImport Objects
editThis functionality is experimental and may be changed or removed completely in a future release.
The import saved objects API enables you to create a set of Kibana saved objects from a file created by the export API.
Note: You cannot access this endpoint via the Console in Kibana.
Request
editPOST /api/saved_objects/_import
Query Parameters
edit-
overwrite
(optional) - (boolean) Overwrite saved objects if they exist already
Request body
editThe request body must be of type multipart/form-data.
-
file
- A file exported using the export API.
Response body
editThe 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 imported.
In the scenario the import wasn’t successful a top level errors
array will contain the objects that failed to import.
Examples
editThe following example imports an index pattern and dashboard.
$ curl -X POST "localhost:5601/api/saved_objects/_import" -H "kbn-xsrf: true" --form file=@file.ndjson
The file.ndjson
file would contain the following.
{"type":"index-pattern","id":"my-pattern","attributes":{"title":"my-pattern-*"}} {"type":"dashboard","id":"my-dashboard","attributes":{"title":"Look at my dashboard"}}
A successful call returns a response code of 200
and a response body
containing a JSON structure similar to the following example:
{ "success": true, "successCount": 2 }
The following example imports an index pattern and dashboard but has a conflict on the index pattern.
$ curl -X POST "localhost:5601/api/saved_objects/_import" -H "kbn-xsrf: true" --form file=@file.ndjson
The file.ndjson
file would contain the following.
{"type":"index-pattern","id":"my-pattern","attributes":{"title":"my-pattern-*"}} {"type":"dashboard","id":"my-dashboard","attributes":{"title":"Look at my dashboard"}}
The call returns a response code of 200
and a response body
containing a JSON structure similar to the following example:
{ "success": false, "successCount": 1, "errors": [ { "id": "my-pattern", "type": "index-pattern", "title": "my-pattern-*", "error": { "type": "conflict" }, }, ], }
The following example imports a visualization and dashboard but the index pattern for the visualization reference doesn’t exist.
$ curl -X POST "localhost:5601/api/saved_objects/_import" -H "kbn-xsrf: true" --form file=@file.ndjson
The file.ndjson
file would contain the following.
{"type":"visualization","id":"my-vis","attributes":{"title":"my-vis"},"references":[{"name":"ref_0","type":"index-pattern","id":"my-pattern-*"}]} {"type":"dashboard","id":"my-dashboard","attributes":{"title":"Look at my dashboard"},"references":[{"name":"ref_0","type":"visualization","id":"my-vis"}]}
The call returns a response code of 200
and a response body
containing a JSON structure similar to the following example:
"success": false, "successCount": 0, "errors": [ { "id": "my-vis", "type": "visualization", "title": "my-vis", "error": { "type": "missing_references", "references": [ { "type": "index-pattern", "id": "my-pattern-*" } ], "blocking": [ { "type": "dashboard", "id": "my-dashboard" } ] } } ]