TomonoriSoejima / Tejun

notes related to working cases
5 stars 3 forks source link

How to fix broken index pattern link in vis objects #19

Open TomonoriSoejima opened 4 years ago

TomonoriSoejima commented 4 years ago

Sometimes you delete index pattern and at the moment the dashboard can no longer present to you any vis objects within.

The error message says [click here to re-create it] but it appears to be a dead link.

image

So here comes a simple fix. Tested in 7.6.0

  1. Go to Kibana -> Saved Objects -> export -> export vis you want to fix.

  2. edit the JSON file

cat export.ndjson | jq -r .references[0].id should be fixed with new id.

  1. new id can be extracted like this. Make sure to replace the value for index-pattern.title
GET .kibana/_search?size=1000
{
  "_source": "index-pattern.title",
  "query": {
    "match": {
      "index-pattern.title": "hotel*"
    }
  }
}
    "hits" : [
      {
        "_index" : ".kibana_1",
        "_type" : "_doc",
        "_id" : "index-pattern:81d9a900-9f10-11ea-9c4f-4f43f41240fb",
        "_score" : 1.1631508,
        "_source" : {
          "index-pattern" : {
            "title" : "hotel*"
          }
        }
      }
    ]
  1. import the edited JSON