From 88a290d2433096374ba9f310f35e1e3be3d58ec1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20=C3=81ngel=20Gonz=C3=A1lez?= Date: Fri, 23 Mar 2018 13:41:02 +0100 Subject: [PATCH] Using config.yml pattern whenever custom id is found --- server/initialize.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/server/initialize.js b/server/initialize.js index 0594850a2..d63868b5e 100644 --- a/server/initialize.js +++ b/server/initialize.js @@ -116,6 +116,13 @@ module.exports = (server, options) => { try{ if(!id) return Promise.reject(new Error('No valid id for index pattern')); if(!patternId) return Promise.reject(new Error('No valid patternId for index pattern')); + + const customPatternRegex = new RegExp(/[a-zA-Z0-9]{8}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{12}/g); + if(id && customPatternRegex.test(id.trim())){ + id = configurationFile.pattern; + patternId = 'index-pattern:' + id.trim(); + } + await elasticRequest .callWithInternalUser('create', { index: '.kibana',