Copy saved objects between spaces
It also allows you to automatically copy related objects, so when you copy a dashboard, this can automatically copy over the associated visualizations, data views, and saved searches, as required. You can request to overwrite any objects that already exist in the target space if they share an identifier or you can use the resolve copy saved objects conflicts API to do this on a per-object basis.
Headers
-
elastic-api-version string
The version of the API to use
Value is
2023-10-31
. Default value is2023-10-31
. -
A required header to protect against CSRF attacks
Body
-
compatibilityMode boolean
Apply various adjustments to the saved objects that are being copied to maintain compatibility between different Kibana versions. Use this option only if you encounter issues with copied saved objects. This option cannot be used with the
createNewCopies
option.Default value is
false
. -
createNewCopies boolean
Create new copies of saved objects, regenerate each object identifier, and reset the origin. When used, potential conflict errors are avoided. This option cannot be used with the
overwrite
andcompatibilityMode
options.Default value is
true
. -
includeReferences boolean
When set to true, all saved objects related to the specified saved objects will also be copied into the target spaces.
Default value is
false
. -
overwrite boolean
When set to true, all conflicts are automatically overridden. When a saved object with a matching type and identifier exists in the target space, that version is replaced with the version from the source space. This option cannot be used with the
createNewCopies
option.Default value is
false
. -
The identifiers of the spaces where you want to copy the specified objects.
curl \
-X POST https://localhost:5601/api/spaces/_copy_saved_objects \
-H "Content-Type: application/json; Elastic-Api-Version=2023-10-31" \
-H "elastic-api-version: 2023-10-31" \
-H "kbn-xsrf: true"
{
"spaces": [
"marketing"
],
"objects": [
{
"id": "my-dashboard",
"type": "dashboard"
}
],
"includeReferences": true
}
{
"spaces": [
"marketing"
],
"objects": [
{
"id": "my-dashboard",
"type": "dashboard"
}
],
"createNewCopies": false,
"includeReferences": true
}
{
"marketing": {
"success": true,
"successCount": 3,
"successResults": [
{
"id": "my-dashboard",
"meta": {
"icon": "dashboardApp",
"title": "Look at my dashboard"
},
"type": "dashboard",
"destinationId": "1e127098-5b80-417f-b0f1-c60c8395358f"
},
{
"id": "my-vis",
"meta": {
"icon": "visualizeApp",
"title": "Look at my visualization"
},
"type": "visualization",
"destinationId": "a610ed80-1c73-4507-9e13-d3af736c8e04"
},
{
"id": "my-index-pattern",
"meta": {
"icon": "indexPatternApp",
"title": "my-pattern-*"
},
"type": "index-pattern",
"destinationId": "bc3c9c70-bf6f-4bec-b4ce-f4189aa9e26b"
}
]
}
}
{
"marketing": {
"success": true,
"successCount": 3,
"successResults": [
{
"id": "my-dashboard",
"meta": {
"icon": "dashboardApp",
"title": "Look at my dashboard"
},
"type": "dashboard"
},
{
"id": "my-vis",
"meta": {
"icon": "visualizeApp",
"title": "Look at my visualization"
},
"type": "visualization"
},
{
"id": "my-index-pattern",
"meta": {
"icon": "indexPatternApp",
"title": "my-pattern-*"
},
"type": "index-pattern"
}
]
}
}
{
"sales": {
"errors": [
{
"id": "my-pattern",
"meta": {
"icon": "indexPatternApp",
"title": "my-pattern-*"
},
"type": "index-pattern",
"error": {
"type": "conflict"
},
"title": "my-pattern-*"
},
{
"id": "my-visualization",
"meta": {
"icon": "visualizeApp",
"title": "Look at my visualization"
},
"type": "my-vis",
"error": {
"type": "conflict",
"destinationId": "another-vis"
},
"title": "Look at my visualization"
},
{
"id": "my-canvas",
"meta": {
"icon": "canvasApp",
"title": "Look at my canvas"
},
"type": "canvas-workpad",
"error": {
"type": "ambiguous_conflict",
"destinations": [
{
"id": "another-canvas",
"title": "Look at another canvas",
"updatedAt": "2020-07-08T16:36:32.377Z"
},
{
"id": "yet-another-canvas",
"title": "Look at yet another canvas",
"updatedAt": "2020-07-05T12:29:54.849Z"
}
]
},
"title": "Look at my canvas"
}
],
"success": false,
"successCount": "1,",
"successResults\"": [
{
"id": "my-dashboard",
"meta": {
"icon": "dashboardApp",
"title": "Look at my dashboard"
},
"type": "dashboard"
}
]
},
"marketing": {
"success": true,
"successCount": 4,
"successResults": [
{
"id": "my-dashboard",
"meta": {
"icon": "dashboardApp",
"title": "Look at my dashboard"
},
"type": "dashboard"
},
{
"id": "my-vis",
"meta": {
"icon": "visualizeApp",
"title": "Look at my visualization"
},
"type": "visualization"
},
{
"id": "my-canvas",
"meta": {
"icon": "canvasApp",
"title": "Look at my canvas"
},
"type": "canvas-workpad"
},
{
"id": "my-index-pattern",
"meta": {
"icon": "indexPatternApp",
"title": "my-pattern-*"
},
"type": "index-pattern"
}
]
}
}
{
"marketing": {
"errors": [
{
"id": "my-vis",
"meta": {
"icon": "visualizeApp",
"title": "Look at my visualization"
},
"type": "visualization",
"error": {
"type": "missing_references",
"references": [
{
"id": "my-pattern-*",
"type": "index-pattern"
}
]
},
"title": "Look at my visualization"
}
],
"success": false,
"successCount": 2,
"successResults": [
{
"id": "my-dashboard",
"meta": {
"icon": "dashboardApp",
"title": "Look at my dashboard"
},
"type": "dashboard"
},
{
"id": "my-canvas",
"meta": {
"icon": "canvasApp",
"title": "Look at my canvas"
},
"type": "canvas-workpad"
}
]
}
}