From 5e61873b772f5467c5215aa9eb02711711b4f1a8 Mon Sep 17 00:00:00 2001 From: Jonathan Buttner <56361221+jonathan-buttner@users.noreply.github.com> Date: Thu, 2 Jul 2020 18:40:39 -0400 Subject: [PATCH] [EPM] Use higher priority than default templates (#70640) * Use higher priority than default templates * Fixing the jest tests --- .../template/__snapshots__/template.test.ts.snap | 6 +++--- .../server/services/epm/elasticsearch/template/template.ts | 7 +++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/x-pack/plugins/ingest_manager/server/services/epm/elasticsearch/template/__snapshots__/template.test.ts.snap b/x-pack/plugins/ingest_manager/server/services/epm/elasticsearch/template/__snapshots__/template.test.ts.snap index 635742c82f9a4..f5fec020bf5b4 100644 --- a/x-pack/plugins/ingest_manager/server/services/epm/elasticsearch/template/__snapshots__/template.test.ts.snap +++ b/x-pack/plugins/ingest_manager/server/services/epm/elasticsearch/template/__snapshots__/template.test.ts.snap @@ -2,7 +2,7 @@ exports[`tests loading base.yml: base.yml 1`] = ` { - "priority": 1, + "priority": 200, "index_patterns": [ "foo-*" ], @@ -105,7 +105,7 @@ exports[`tests loading base.yml: base.yml 1`] = ` exports[`tests loading coredns.logs.yml: coredns.logs.yml 1`] = ` { - "priority": 1, + "priority": 200, "index_patterns": [ "foo-*" ], @@ -208,7 +208,7 @@ exports[`tests loading coredns.logs.yml: coredns.logs.yml 1`] = ` exports[`tests loading system.yml: system.yml 1`] = ` { - "priority": 1, + "priority": 200, "index_patterns": [ "whatsthis-*" ], diff --git a/x-pack/plugins/ingest_manager/server/services/epm/elasticsearch/template/template.ts b/x-pack/plugins/ingest_manager/server/services/epm/elasticsearch/template/template.ts index 06c07da6cd77a..2de378f717534 100644 --- a/x-pack/plugins/ingest_manager/server/services/epm/elasticsearch/template/template.ts +++ b/x-pack/plugins/ingest_manager/server/services/epm/elasticsearch/template/template.ts @@ -247,8 +247,11 @@ function getBaseTemplate( packageName: string ): IndexTemplate { return { - // This takes precedence over all index templates installed with the 'base' package - priority: 1, + // This takes precedence over all index templates installed by ES by default (logs-*-* and metrics-*-*) + // if this number is lower than the ES value (which is 100) this template will never be applied when a data stream + // is created. I'm using 200 here to give some room for users to create their own template and fit it between the + // default and the one the ingest manager uses. + priority: 200, // To be completed with the correct index patterns index_patterns: [`${templateName}-*`], template: {