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]>
  • Loading branch information
lezzago authored Sep 7, 2023
1 parent 4d514bd commit 1003936
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 @@ -99,9 +101,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 1003936

Please sign in to comment.