Skip to content
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

Dashboard migration issue from 6.1 dashboards #42519

Closed
stacey-gammon opened this issue Aug 2, 2019 · 0 comments · Fixed by #42520
Closed

Dashboard migration issue from 6.1 dashboards #42519

stacey-gammon opened this issue Aug 2, 2019 · 0 comments · Fixed by #42520
Labels
bug Fixes for quality problems that affect the customer experience

Comments

@stacey-gammon
Copy link
Contributor

stacey-gammon commented Aug 2, 2019

If you have a dashboard created in 6.1 that contains a saved search that has been saved with column or sort overrides on the panel, you will not be able to upgrade to 7.3. (Caveat - this is more theory from looking at the code and knowing the problem than actually tested, but I'm relatively confident).

The issue is, in migrate610PanelToLatest:

  const embeddableConfig = uiState ? uiState[`P-${panel.panelIndex}`] : {};

  // 2. (6.4) remove columns, sort properties
  if (panel.columns || panel.sort) {
    embeddableConfig.columns = panel.columns;
    embeddableConfig.sort = panel.sort;
  }

When uiState is an empty object, embeddableConfig is undefined.

Luckily, the (almost) same code in migratePre61PanelToLatest doesn't have this issue:

  const embeddableConfig = uiState ? uiState[`P-${panel.panelIndex}`] || {} : {};

  if (panel.columns || panel.sort) {
    embeddableConfig.columns = panel.columns;
    embeddableConfig.sort = panel.sort;
  }

so it's only explicitly for 6.1.

Another good point to mention is that this is the start of the bug, but what really kills it is because the document doesn't get updated by the uiStateJSON being removed because it bails early, and the mappings were changed. I could have waited till a major to update the mapping to be more careful.

cc @rudolf @timroes

JSON that will hit the error if imported (created from 6.1)

  {
    "_id": "18bb2490-b536-11e9-b1af-cff0dd87ed28",
    "_type": "dashboard",
    "_source": {
      "title": "dash with overrides",
      "hits": 0,
      "description": "",
      "panelsJSON": "[{\"gridData\":{\"h\":3,\"i\":\"1\",\"w\":6,\"x\":0,\"y\":0},\"id\":\"088bc570-b536-11e9-b1af-cff0dd87ed28\",\"panelIndex\":\"1\",\"type\":\"visualization\",\"version\":\"6.1.4\"},{\"gridData\":{\"w\":6,\"h\":3,\"x\":6,\"y\":0,\"i\":\"2\"},\"version\":\"6.1.4\",\"panelIndex\":\"2\",\"type\":\"search\",\"id\":\"fc91ab90-b535-11e9-b1af-cff0dd87ed28\",\"columns\":[\"_id\",\"_score\",\"status\"],\"sort\":[\"_id\",\"asc\"]}]",
      "optionsJSON": "{\"darkTheme\":false,\"hidePanelTitles\":false,\"useMargins\":true}",
      "uiStateJSON": "{}",
      "version": 1,
      "timeRestore": true,
      "timeTo": "now",
      "timeFrom": "now-15y",
      "refreshInterval": {
        "display": "Off",
        "pause": false,
        "value": 0
      },
      "kibanaSavedObjectMeta": {
        "searchSourceJSON": "{\"query\":{\"language\":\"lucene\",\"query\":\"\"},\"filter\":[],\"highlightAll\":true,\"version\":true}"
      }
    },
    "_meta": {
      "savedObjectVersion": 2
    }
  },
@stacey-gammon stacey-gammon added the bug Fixes for quality problems that affect the customer experience label Aug 2, 2019
rudolf added a commit to rudolf/kibana that referenced this issue Aug 2, 2019
rudolf added a commit that referenced this issue Aug 6, 2019
* Fixes #42519 dashboard migration bug

* Tests

* Dashboard migration errors: log stack and dashboard document
rudolf added a commit to rudolf/kibana that referenced this issue Aug 6, 2019
* Fixes elastic#42519 dashboard migration bug

* Tests

* Dashboard migration errors: log stack and dashboard document
rudolf added a commit to rudolf/kibana that referenced this issue Aug 6, 2019
* Fixes elastic#42519 dashboard migration bug

* Tests

* Dashboard migration errors: log stack and dashboard document
rudolf added a commit that referenced this issue Aug 6, 2019
* Fixes #42519 dashboard migration bug

* Tests

* Dashboard migration errors: log stack and dashboard document
rudolf added a commit that referenced this issue Aug 6, 2019
* Fixes #42519 dashboard migration bug

* Tests

* Dashboard migration errors: log stack and dashboard document
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant