From 3b92fa2a2ad9b5463d8583dfb18a4d455757cdda Mon Sep 17 00:00:00 2001 From: Marshall Main <55718608+marshallmain@users.noreply.github.com> Date: Fri, 4 Dec 2020 01:19:29 -0500 Subject: [PATCH] Only attempt to rollover signals index if version < builtin version (#84982) --- .../lib/detection_engine/routes/index/create_index_route.ts | 2 +- .../lib/detection_engine/routes/index/read_index_route.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/index/create_index_route.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/index/create_index_route.ts index 287459cf5ec9a..de28d2eee1805 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/index/create_index_route.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/index/create_index_route.ts @@ -78,7 +78,7 @@ export const createDetectionIndex = async ( const indexExists = await getIndexExists(callCluster, index); if (indexExists) { const indexVersion = await getIndexVersion(callCluster, index); - if (indexVersion !== SIGNALS_TEMPLATE_VERSION) { + if ((indexVersion ?? 0) < SIGNALS_TEMPLATE_VERSION) { await callCluster('indices.rollover', { alias: index }); } } else { diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/index/read_index_route.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/index/read_index_route.ts index d1b1a2b4dd0eb..497352b563d36 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/index/read_index_route.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/index/read_index_route.ts @@ -38,7 +38,7 @@ export const readIndexRoute = (router: IRouter) => { let mappingOutdated: boolean | null = null; try { const indexVersion = await getIndexVersion(clusterClient.callAsCurrentUser, index); - mappingOutdated = indexVersion !== SIGNALS_TEMPLATE_VERSION; + mappingOutdated = (indexVersion ?? 0) < SIGNALS_TEMPLATE_VERSION; } catch (err) { const error = transformError(err); // Some users may not have the view_index_metadata permission necessary to check the index mapping version