diff --git a/libbeat/dashboards/importer.go b/libbeat/dashboards/importer.go index a9427651eb28..40d0e68a22e2 100644 --- a/libbeat/dashboards/importer.go +++ b/libbeat/dashboards/importer.go @@ -298,6 +298,11 @@ func (imp Importer) ImportKibanaDir(dir string) error { versionPath := "7" + // Loads the internal index pattern + if imp.fields != nil { + imp.loader.ImportIndex(imp.fields) + } + dir = path.Join(dir, versionPath) imp.loader.statusMsg("Importing directory %v", dir) @@ -305,11 +310,6 @@ func (imp Importer) ImportKibanaDir(dir string) error { if _, err := os.Stat(dir); err != nil { return newErrNotFound("No directory %s", dir) } - - // Loads the internal index pattern - if imp.fields != nil { - imp.loader.ImportIndex(imp.fields) - } check := []string{} if !imp.cfg.OnlyDashboards { check = append(check, "index-pattern")