From 5ceb3742b97316197095cd79accdfc16f091a614 Mon Sep 17 00:00:00 2001 From: Ashish Agrawal Date: Thu, 7 Sep 2023 10:49:50 -0700 Subject: [PATCH 1/2] auto expand replicas (#539) Signed-off-by: Ashish Agrawal (cherry picked from commit 10039360a10f36c9696cc5750c8cece202d709ac) --- .../opensearch/securityanalytics/util/RuleIndices.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/opensearch/securityanalytics/util/RuleIndices.java b/src/main/java/org/opensearch/securityanalytics/util/RuleIndices.java index 5a0da3a2e..da3add8b2 100644 --- a/src/main/java/org/opensearch/securityanalytics/util/RuleIndices.java +++ b/src/main/java/org/opensearch/securityanalytics/util/RuleIndices.java @@ -5,6 +5,8 @@ package org.opensearch.securityanalytics.util; import java.util.Set; + +import com.google.common.collect.ImmutableMap; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.opensearch.OpenSearchStatusException; @@ -98,9 +100,13 @@ public static String ruleMappings() throws IOException { public void initRuleIndex(ActionListener actionListener, boolean isPrepackaged) throws IOException { if (!ruleIndexExists(isPrepackaged)) { + Settings indexSettings = Settings.builder() + .put("index.hidden", true) + .put("index.auto_expand_replicas", "0-all") + .build(); CreateIndexRequest indexRequest = new CreateIndexRequest(getRuleIndex(isPrepackaged)) .mapping(ruleMappings()) - .settings(Settings.builder().put("index.hidden", true).build()); + .settings(indexSettings); client.admin().indices().create(indexRequest, actionListener); } } From abf68b217076c1bf1e21146ac3fea5124d3e62b6 Mon Sep 17 00:00:00 2001 From: Ashish Agrawal Date: Fri, 8 Sep 2023 08:03:20 -0700 Subject: [PATCH 2/2] Remove extra import Signed-off-by: Ashish Agrawal --- .../java/org/opensearch/securityanalytics/util/RuleIndices.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/org/opensearch/securityanalytics/util/RuleIndices.java b/src/main/java/org/opensearch/securityanalytics/util/RuleIndices.java index da3add8b2..adb0fded1 100644 --- a/src/main/java/org/opensearch/securityanalytics/util/RuleIndices.java +++ b/src/main/java/org/opensearch/securityanalytics/util/RuleIndices.java @@ -6,7 +6,6 @@ import java.util.Set; -import com.google.common.collect.ImmutableMap; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.opensearch.OpenSearchStatusException;