-
Notifications
You must be signed in to change notification settings - Fork 124
Support exporting dashboards using the saved objects API #1357
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support exporting dashboards using the saved objects API #1357
Conversation
internal/kibana/dashboards.go
Outdated
logger.Debug("Export dashboards using the Kibana Saved Objects Export API") | ||
|
||
exportRequest := exportSavedObjectsRequest{ | ||
ExcludeExportDetails: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be needed to set IncludeReferencesDeep
to true, to get other references used in the dashboards like tags, searches, maps... ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure, trying to add it.
internal/kibana/dashboards.go
Outdated
if sv.LessThan(semver.MustParse("8.8.0")) { | ||
return c.exportWithDashboardsAPI(dashboardIDs) | ||
} | ||
|
||
return c.exportWithSavedObjectsAPI(dashboardIDs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
💚 Build Succeeded
History
cc @jsoriano |
internal/kibana/dashboards.go
Outdated
dashboards = append(dashboards, dashboard) | ||
} | ||
|
||
return dashboards, nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To reuse the code introduced in #1565 if finally merged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested these changes in some packages, and it looks that it works as expected.
Just one note when trying to export a dashboard from aws
package (using Elastic stack 9.0.0).
Tested to export [Metrics AWS] ALB Overview (ID: aws-24f3e07a-b5f5-470c-8305-47c9626db37b)
dashboard and there was change that I didn't expect:
@@ -1937,10 +1977,8 @@
"version": 2
},
"coreMigrationVersion": "8.8.0",
- "created_at": "2024-07-23T10:27:18.232Z",
+ "created_at": "2025-05-21T15:28:04.486Z",
"id": "aws-24f3e07a-b5f5-470c-8305-47c9626db37b",
- "managed": false,
- "aws": false,
"references": [
{
"id": "metrics-*"
At least that aws
field. I don't know what that it mean. Tested with two other AWS dashboards and that change is not present, that field was not present.
- [Metrics AWS] EC2 Overview (ID: aws-c5846400-f7fb-11e8-af03-c999c9dea608)
- [Logs AWS] S3 Server Access Log Overview (ID: aws-4746e000-bacd-11e9-9f70-1f7bda85a5eb)
No idea where this @anil-elastic do you happen to remember how you exported these dashboards? I think we can ignore this, if this field is not being exported it is likely being ignored by Kibana. |
Just tried with
As the stack is 8.18.1 version, they both should be using the same API and it is shown in the debug output (there is an extra
There are other differences in the diff, I just show here the ones related to
@@ -1937,10 +1977,9 @@
"version": 2
},
"coreMigrationVersion": "8.8.0",
- "created_at": "2024-07-23T10:27:18.232Z",
+ "created_at": "2025-05-22T07:38:34.414Z",
"id": "aws-24f3e07a-b5f5-470c-8305-47c9626db37b",
- "managed": false,
- "aws": false,
+ "managed": true,
"references": [
{
"id": "metrics-*",
@@ -1937,10 +1977,8 @@
"version": 2
},
"coreMigrationVersion": "8.8.0",
- "created_at": "2024-07-23T10:27:18.232Z",
+ "created_at": "2025-05-22T07:38:34.414Z",
"id": "aws-24f3e07a-b5f5-470c-8305-47c9626db37b",
- "managed": false,
- "aws": false,
"references": [
{
"id": "metrics-*", I cannot tell why that |
This field is explicitly removed by elastic-package, and managed by Fleet on installation. Maybe this dashboard was exported without |
Ah! Got it. I missed that PR, thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Old deprecated API is removed in 9.0. Start using the saved objects API from this version.