2019-03-05 21:42:02 +01:00
[[saved-objects-api-export]]
2019-09-06 18:09:57 +02:00
=== Export objects API
++++
<titleabbrev>Export objects</titleabbrev>
++++
2019-03-05 21:42:02 +01:00
2019-10-16 22:10:40 +02:00
experimental[] Retrieve sets of saved objects that you want to import into {kib}.
2019-03-05 21:42:02 +01:00
2019-09-06 18:09:57 +02:00
[[saved-objects-api-export-request]]
2019-03-05 21:42:02 +01:00
==== Request
`POST /api/saved_objects/_export`
2019-10-18 19:17:54 +02:00
`POST /s/<space_id>/api/saved_objects/_export`
[[saved-objects-api-export-path-params]]
==== Path parameters
`space_id`::
(Optional, string) An identifier for the space. If `space_id` is not provided in the URL, the default space is used.
2019-09-06 18:09:57 +02:00
[[saved-objects-api-export-request-request-body]]
==== Request body
`type`::
(Optional, array|string) The saved object types to include in the export.
2019-10-18 19:17:54 +02:00
2019-09-06 18:09:57 +02:00
`objects`::
(Optional, array) A list of objects to export.
2019-10-18 19:17:54 +02:00
2019-09-06 18:09:57 +02:00
`includeReferencesDeep`::
(Optional, boolean) Includes all of the referenced objects in the exported objects.
2019-03-05 21:42:02 +01:00
2019-10-16 12:48:34 +02:00
`excludeExportDetails`::
(Optional, boolean) Do not add export details entry at the end of the stream.
2019-09-06 18:09:57 +02:00
TIP: You must include `type` or `objects` in the request body.
2019-03-05 21:42:02 +01:00
2019-09-06 18:09:57 +02:00
[[saved-objects-api-export-request-response-body]]
2019-03-05 21:42:02 +01:00
==== Response body
2019-10-16 12:48:34 +02:00
The format of the response body is newline delimited JSON. Each exported object is exported as a valid JSON record and separated by the newline character '\n'.
When `excludeExportDetails=false` (the default) we append an export result details record at the end of the file after all the saved object records. The export result details object has the following format:
[source,json]
--------------------------------------------------
{
"exportedCount": 27,
"missingRefCount": 2,
"missingReferences": [
{ "id": "an-id", "type": "visualisation"},
{ "id": "another-id", "type": "index-pattern"}
]
}
--------------------------------------------------
2019-09-06 18:09:57 +02:00
[[export-objects-api-create-request-codes]]
==== Response code
2019-03-05 21:42:02 +01:00
2019-10-18 19:17:54 +02:00
`200`::
2019-09-06 18:09:57 +02:00
Indicates a successful call.
[[ssaved-objects-api-create-example]]
2019-03-05 21:42:02 +01:00
==== Examples
2019-09-06 18:09:57 +02:00
Export all index pattern saved objects:
2019-03-05 21:42:02 +01:00
[source,js]
--------------------------------------------------
POST api/saved_objects/_export
{
2019-06-05 13:47:21 +02:00
"type": "index-pattern"
2019-03-05 21:42:02 +01:00
}
--------------------------------------------------
// KIBANA
2019-10-16 12:48:34 +02:00
Export all index pattern saved objects and exclude the export summary from the stream:
[source,js]
--------------------------------------------------
POST api/saved_objects/_export
{
"type": "index-pattern",
"excludeExportDetails": true
}
--------------------------------------------------
// KIBANA
2019-09-06 18:09:57 +02:00
Export a specific saved object:
2019-06-05 13:47:21 +02:00
[source,js]
--------------------------------------------------
POST api/saved_objects/_export
{
"objects": [
{
"type": "dashboard",
"id": "be3733a0-9efe-11e7-acb3-3dab96693fab"
}
]
}
--------------------------------------------------
2019-09-06 18:09:57 +02:00
// KIBANA
2019-10-16 12:48:34 +02:00
Export a specific saved object and it's related objects :
[source,js]
--------------------------------------------------
POST api/saved_objects/_export
{
"objects": [
{
"type": "dashboard",
"id": "be3733a0-9efe-11e7-acb3-3dab96693fab"
}
],
"includeReferencesDeep": true
}
--------------------------------------------------
// KIBANA