From 5cf0b84880c7fba9881d839873697724c15f591b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20P=C3=A9rez-Aradros=20Herce?= Date: Mon, 28 Oct 2019 12:14:21 +0000 Subject: [PATCH] Load index pattern before dashboards during setup (#14237) During setup, if dashboards import fails (or maybe dashboards folder is not present, like in development mode) we will not push the index pattern. This change makes sure we deploy the index pattern first, then proceed with dashboards. --- libbeat/dashboards/importer.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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")