elastic / kibana

Your window into the Elastic Stack
https://www.elastic.co/products/kibana
Other
19.63k stars 8.22k forks source link

Migration of dashboard fails due to missing panelIndex property #44639

Closed kertal closed 5 years ago

kertal commented 5 years ago

Kibana version: 7.3.1 Elasticsearch version: 7.3.1

Original install method (e.g. download page, yum, from source, etc.): docker

Describe the bug: When migrating a dashboard like the following in it's 6.8 version to 7.3.1

{
          "dashboard" : {
            "hits" : 0,
            "timeFrom" : "now-24h",
            "timeTo" : "now",
            "description" : "",
            "uiStateJSON" : "{}",
            "title" : "fancy stuff",
            "timeRestore" : true,
            "version" : 1,
            "panelsJSON" : """[{"id":"funky-funky","type":"visualization","size_x":7,"size_y":5,"col":1,"row":1},{"id":"funky-funky2","type":"search","size_x":5,"size_y":5,"col":8,"row":1,"columns":["_source"],"sort":["@timestamp","desc"]}]""",
            "optionsJSON" : """{"darkTheme":false}""",
            "kibanaSavedObjectMeta" : {
              "searchSourceJSON" : """{"filter":[{"query":{"query_string":{"query":"user:spiderman","analyze_wildcard":true}}}]}"""
            }
          },
          "type" : "dashboard"
        }

the migration fails due to the missing panelIndex in the panelsJSON array

here's the relevant error in the log:

{"type":"log","@timestamp":"2019-09-02T15:52:07Z","tags":["warning","migrations"],"pid":7,"message":"Exception @ migrations730 while trying to migrate dashboard panels!\nError: TypeError: Cannot read property 'toString' of undefined\n    at migratePre61PanelToLatest ......

This error is caught, but then the migration process tries to insert the unchanged document, which leads to the following error

Error: mapping set to strict, dynamic introduction of [uiStateJSON] within [dashboard] is not allowed

A successful migration would have removed that property, but now migration is failing due to the strict mapping restriction.

elasticmachine commented 5 years ago

Pinging @elastic/kibana-platform

elasticmachine commented 5 years ago

Pinging @elastic/kibana-app