Skip to content

Commit

Permalink
Only attempt to rollover signals index if version < builtin version (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
marshallmain authored Dec 4, 2020
1 parent 7277aaa commit 3b92fa2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3b92fa2

Please sign in to comment.