Copy Visualizations in Kibana 6

Copying visualizations in Kibana 6 has become difficult if not impossible. Formerly (v5) you could simply export a Viz, change the id and re-import. This no longer works. It's reproducible on any visualization of ours:

  1. Export Viz

  2. Change Id

  3. Import Viz -> Error:
    Saved Objects: Importing NameOfMyVizualisation (foo) failed: Could not locate that index-pattern-field (id: source.keyword)

    [
    {
    "_id": "foo",
    "_type": "visualization",
    "_source": {
    "title": "NameOfMyVizualization",
    "visState": "{"title":"Logs - By Source/Type (TEST)","type":"pie","params":{"type":"pie","addTooltip":true,"addLegend":true,"legendPosition":"right","isDonut":false,"labels":{"show":false,"values":true,"last_level":true,"truncate":100}},"aggs":[{"id":"1","enabled":true,"type":"count","schema":"metric","params":{}},{"id":"2","enabled":true,"type":"terms","schema":"split","params":{"field":"source.keyword","size":5,"order":"desc","orderBy":"1","row":false}},{"id":"3","enabled":true,"type":"terms","schema":"segment","params":{"field":"type.keyword","size":5,"order":"desc","orderBy":"1"}}]}",
    "uiStateJSON": "{"vis":{"colors":{"SUCCESS":"#629E51","WARNING":"#E5AC0E","ERROR":"#BF1B00","INFO":"#64B0C8"},"legendOpen":false}}",
    "description": "",
    "savedSearchId": "018f2a50-fc37-11e7-840e-3b282f80f2e2",
    "version": 1,
    "kibanaSavedObjectMeta": {
    "searchSourceJSON": "{"filter":[],"query":{"query":"NOT type:(INFO,SUCCESS)","language":"lucene"}}"
    }
    }
    }
    ]

UPDATE: As I'm unable to reply below I'll update here:
It turns out in our PROD index many fields which were simple "keyword" fields in TEST had become "objects" with a nested "fields" structure containing a sub-field called "keyword". No idea how this came about but basically the mappings were different in TEST and PROD. In TEST the field was called "type" and in PROD it was called "type.keyword".

i just did a quick test:

  • i exported a visualization
  • i opened the export file, i removed the id (it will get auto generated) and i changed the name
  • saved the file and imported it

everything works as expected.

can you check your index pattern and see if the source.keyword field is there at all ?
are you exporting a visualization created with current version of kibana or an old one from 5.x ?

2 Likes

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.