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:
-
Export Viz
-
Change Id
-
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".