Skip to content

Commit

Permalink
[Backport 2.10] Auto expand replicas (#554)
Browse files Browse the repository at this point in the history
* auto expand replicas (#539)

Signed-off-by: Ashish Agrawal <[email protected]>
(cherry picked from commit 1003936)

* Remove extra import

Signed-off-by: Ashish Agrawal <[email protected]>

---------

Signed-off-by: Ashish Agrawal <[email protected]>
Co-authored-by: Ashish Agrawal <[email protected]>
Co-authored-by: Ashish Agrawal <[email protected]>
  • Loading branch information
3 people authored Sep 11, 2023
1 parent a59bb63 commit 0b4bc08
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 @@ -99,9 +100,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 0b4bc08

Please sign in to comment.