Skip to content

Commit

Permalink
[Backport 2.6] Auto expand replicas (#550)
Browse files Browse the repository at this point in the history
Signed-off-by: Ashish Agrawal <[email protected]>
  • Loading branch information
opensearch-trigger-bot[bot] authored Sep 13, 2023
1 parent 74a5453 commit 9aac181
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package org.opensearch.securityanalytics.util;

import java.util.Set;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.opensearch.OpenSearchStatusException;
Expand Down Expand Up @@ -92,9 +93,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 9aac181

Please sign in to comment.