Closed chingis-elastic closed 2 years ago
Pinging @elastic/kibana-vis-editors (Team:VisEditors)
Please note that this seems to use the deprecated dashboard import api: https://www.elastic.co/guide/en/kibana/current/dashboard-api.html
not sure which team owns it but I guess it’s a problem on that level.
Hey @chingis-elastic, when I repeat the steps from the issue it works fine for me. I noticed that my saved object has some extra properties that don't exist in the POST body user provided:
"coreMigrationVersion": "7.15.0",
"migrationVersion": {
"lens": "7.15.0"
},
Could you ask the customer if they removed it manually or how are they process saved object to dashboard import api? I agree with Joe though that it might be better for them to use https://www.elastic.co/guide/en/kibana/current/saved-objects-api-import.html instead of deprecated dashboard api.
Extra questions (thanks @flash1293) Also, how exactly do they export saved objects? Via UI or are you using an api? If yes which one? Could you provide an example of how exactly the saved object looks like after exporting?
@mbondyra Thanks, good catch! I removed handling of those 2 fields in our code some time ago naively thinking it wouldn't impact anything - most dashboards seemed to work (except Lens ones, now that we see). Putting MigrationVersion
and CoreMigrationVersion
back resolves the issue. So yeah, totally on our side - I'll add the fix on Monday.
The reason I removed them is that I wanted our payloads be "version agnostic", e.g. whenever a user pulls a dashboard after minor edit, they wouldn't get a local diff related to version change. Now I see that users will have to live with those minor version-related diffs.
@flash1293 At the moment, we use /saved_objects/_bulk_get
endpoint to get dashboard(s) and all their references. Later, we import those via /dashboards/import
endpoint as shown in the description.
The version information is important here because saved objects frequently change their internal format in small and subtle ways and this version information makes sure we can internally run migrations on them before storing them so they continue to work.
About the dashboards import api - I don’t know the exact plans here but this api will definitely go away at some point, it makes sense to start thinking about how to switch to the saved objects import api linked above.
closing this as it’s resolved - thanks for reaching out!
Kibana version: 7.15.0
Elasticsearch version: 7.15.0
Server OS version: https://cloud.elastic.co
Browser version: Firefox 93.0 (64-bit)
Browser OS version: macOS 11.6
Original install method (e.g. download page, yum, from source, etc.): https://cloud.elastic.co
Describe the bug:
We have recently moved Index Patterns configuration across our stack from Saved Objects API to Index Patterns API. Now, Lens-based dashboards that we manage through Kibana import API no longer work for us. The error message in browser console is
while there are no other errors in Kibana logs.
Steps to reproduce:
POST/api/index_patterns/index_pattern
{
"index_pattern": {
"id": "my-test-",
"timeFieldName": "@timestamp",
"title": "my-test-"
},
"override": true,
"refresh_fields": true
}
{ "objects": [ { "id": "bc926ea0-2d8b-11ec-ba1d-e9d8c77757b0", "type": "lens", "references": [ { "id": "my-test-", "name": "indexpattern-datasource-current-indexpattern", "type": "index-pattern" }, { "id": "my-test-", "name": "indexpattern-datasource-layer-ad38d6a1-fb4f-4a8a-a6a6-d572762f741c", "type": "index-pattern" }, { "id": "my-test-*", "name": "filter-index-pattern-0", "type": "index-pattern" } ], "attributes": { "description": "", "state": { "datasourceStates": { "indexpattern": { "layers": { "ad38d6a1-fb4f-4a8a-a6a6-d572762f741c": { "columnOrder": [ "582dac4f-feb2-4a1c-a1de-f7265b5c6ba6", "dd7cd6c0-b4e6-4211-822a-69f7ad67b093" ], "columns": { "582dac4f-feb2-4a1c-a1de-f7265b5c6ba6": { "dataType": "string", "isBucketed": true, "label": "Top values of message.keyword", "operationType": "terms", "params": { "missingBucket": false, "orderBy": { "columnId": "dd7cd6c0-b4e6-4211-822a-69f7ad67b093", "type": "column" }, "orderDirection": "desc", "otherBucket": true, "size": 5 }, "scale": "ordinal", "sourceField": "message.keyword" }, "dd7cd6c0-b4e6-4211-822a-69f7ad67b093": { "dataType": "number", "isBucketed": false, "label": "Count of records", "operationType": "count", "scale": "ratio", "sourceField": "Records" } }, "incompleteColumns": {} } } } }, "filters": [ { "$state": { "store": "appState" }, "exists": { "field": "message" }, "meta": { "alias": null, "disabled": false, "indexRefName": "filter-index-pattern-0", "key": "message", "negate": false, "type": "exists" } } ], "query": { "language": "kuery", "query": "" }, "visualization": { "axisTitlesVisibilitySettings": { "x": true, "yLeft": true, "yRight": true }, "fittingFunction": "None", "gridlinesVisibilitySettings": { "x": true, "yLeft": true, "yRight": true }, "labelsOrientation": { "x": 0, "yLeft": 0, "yRight": 0 }, "layers": [ { "accessors": [ "dd7cd6c0-b4e6-4211-822a-69f7ad67b093" ], "layerId": "ad38d6a1-fb4f-4a8a-a6a6-d572762f741c", "layerType": "data", "position": "top", "seriesType": "bar_stacked", "showGridlines": false, "xAccessor": "582dac4f-feb2-4a1c-a1de-f7265b5c6ba6" } ], "legend": { "isVisible": true, "position": "right" }, "preferredSeriesType": "bar_stacked", "tickLabelsVisibilitySettings": { "x": true, "yLeft": true, "yRight": true }, "valueLabels": "hide", "yLeftExtent": { "mode": "full" }, "yRightExtent": { "mode": "full" } } }, "title": "My viz in Visualize Library", "visualizationType": "lnsXY" } }, { "id": "f6dcc3d0-2d8b-11ec-ba1d-e9d8c77757b0", "type": "dashboard", "references": [ { "id": "bc926ea0-2d8b-11ec-ba1d-e9d8c77757b0", "name": "8b87b3ba-3810-4ac3-9787-60dbde360b4d:panel_8b87b3ba-3810-4ac3-9787-60dbde360b4d", "type": "lens" } ], "attributes": { "description": "", "hits": 0, "kibanaSavedObjectMeta": { "searchSourceJSON": "{\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"filter\":[]}" }, "optionsJSON": "{\"useMargins\":true,\"syncColors\":false,\"hidePanelTitles\":false}", "panelsJSON": "[{\"version\":\"7.15.0\",\"type\":\"lens\",\"gridData\":{\"x\":0,\"y\":0,\"w\":24,\"h\":15,\"i\":\"8b87b3ba-3810-4ac3-9787-60dbde360b4d\"},\"panelIndex\":\"8b87b3ba-3810-4ac3-9787-60dbde360b4d\",\"embeddableConfig\":{\"enhancements\":{}},\"panelRefName\":\"panel_8b87b3ba-3810-4ac3-9787-60dbde360b4d\"}]", "timeRestore": false, "title": "My dash with viz from Visualize Library", "version": 1 } } ] } < HTTP/2.0 200 OK < Cache-Control: private, no-cache, no-store, must-revalidate < Content-Type: application/json; charset=utf-8 < Date: Fri, 15 Oct 2021 07:53:31 GMT < Kbn-License-Sig: xxx < Kbn-Name: xxx < Referrer-Policy: no-referrer-when-downgrade < Vary: accept-encoding < X-Cloud-Request-Id: oVmeGUKkQMSoAOzBOa1jfA < X-Content-Type-Options: nosniff < X-Found-Handling-Cluster: xxx < X-Found-Handling-Instance: instance-0000000017
Error: Could not find reference for filter-index-pattern-0 injectFilterReferences https://logging.eu-west-1.aws.qa.cld.elstc.co/44040/bundles/plugin/lens/8.0.0/lens.chunk.0.js:8 injectFilterReferences https://logging.eu-west-1.aws.qa.cld.elstc.co/44040/bundles/plugin/lens/8.0.0/lens.chunk.0.js:8 getMergedSearchContext https://logging.eu-west-1.aws.qa.cld.elstc.co/44040/bundles/plugin/lens/8.0.0/lens.chunk.1.js:3 render https://logging.eu-west-1.aws.qa.cld.elstc.co/44040/bundles/plugin/lens/8.0.0/lens.chunk.1.js:3 componentDidMount https://logging.eu-west-1.aws.qa.cld.elstc.co/44040/bundles/plugin/embeddable/kibana/embeddable.plugin.js:6 Bl https://logging.eu-west-1.aws.qa.cld.elstc.co/44040/bundles/kbn-ui-shared-deps/kbn-ui-shared-deps.js:390 unstable_runWithPriority https://logging.eu-west-1.aws.qa.cld.elstc.co/44040/bundles/kbn-ui-shared-deps/kbn-ui-shared-deps.js:398 Kr https://logging.eu-west-1.aws.qa.cld.elstc.co/44040/bundles/kbn-ui-shared-deps/kbn-ui-shared-deps.js:390 Fl https://logging.eu-west-1.aws.qa.cld.elstc.co/44040/bundles/kbn-ui-shared-deps/kbn-ui-shared-deps.js:390 Cl https://logging.eu-west-1.aws.qa.cld.elstc.co/44040/bundles/kbn-ui-shared-deps/kbn-ui-shared-deps.js:390 Qr https://logging.eu-west-1.aws.qa.cld.elstc.co/44040/bundles/kbn-ui-shared-deps/kbn-ui-shared-deps.js:390 unstable_runWithPriority https://logging.eu-west-1.aws.qa.cld.elstc.co/44040/bundles/kbn-ui-shared-deps/kbn-ui-shared-deps.js:398 Kr https://logging.eu-west-1.aws.qa.cld.elstc.co/44040/bundles/kbn-ui-shared-deps/kbn-ui-shared-deps.js:390 Qr https://logging.eu-west-1.aws.qa.cld.elstc.co/44040/bundles/kbn-ui-shared-deps/kbn-ui-shared-deps.js:390 Jr https://logging.eu-west-1.aws.qa.cld.elstc.co/44040/bundles/kbn-ui-shared-deps/kbn-ui-shared-deps.js:390 _l https://logging.eu-west-1.aws.qa.cld.elstc.co/44040/bundles/kbn-ui-shared-deps/kbn-ui-shared-deps.js:390 enqueueSetState https://logging.eu-west-1.aws.qa.cld.elstc.co/44040/bundles/kbn-ui-shared-deps/kbn-ui-shared-deps.js:390 setState https://logging.eu-west-1.aws.qa.cld.elstc.co/44040/bundles/kbn-ui-shared-deps/kbn-ui-shared-deps.js:361 componentDidMount https://logging.eu-west-1.aws.qa.cld.elstc.co/44040/bundles/plugin/embeddable/kibana/embeddable.plugin.js:6