Skip to content

Commit

Permalink
auto expand replicas (#539)
Browse files Browse the repository at this point in the history
Signed-off-by: Ashish Agrawal <[email protected]>
(cherry picked from commit 1003936)
  • Loading branch information
lezzago authored and github-actions[bot] committed Sep 7, 2023
1 parent 075970a commit 20de2b9
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -92,9 +94,13 @@ public static String ruleMappings() throws IOException {

public void initRuleIndex(ActionListener<CreateIndexResponse> 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);
}
}
Expand Down

0 comments on commit 20de2b9

Please sign in to comment.