Skip to content

Commit 5ec87b2

Browse files
authored
auto expand replica 0-2 on custom result index (#1362)
Signed-off-by: Amit Galitzky <amgalitz@amazon.com>
1 parent f62885a commit 5ec87b2

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/main/java/org/opensearch/timeseries/indices/IndexManagement.java

+8
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ public abstract class IndexManagement<IndexType extends Enum<IndexType> & TimeSe
103103
public static final String META = "_meta";
104104
public static final String SCHEMA_VERSION = "schema_version";
105105

106+
public static final String customResultIndexAutoExpandReplica = "0-2";
106107
protected ClusterService clusterService;
107108
protected final Client client;
108109
protected final AdminClient adminClient;
@@ -1349,6 +1350,13 @@ protected void initResultIndexDirectly(
13491350
if (defaultResultIndex) {
13501351
adminClient.indices().create(request, markMappingUpToDate(resultIndex, actionListener));
13511352
} else {
1353+
request
1354+
.settings(
1355+
Settings
1356+
.builder()
1357+
// Support up to 2 replicas at least
1358+
.put(IndexMetadata.SETTING_AUTO_EXPAND_REPLICAS, customResultIndexAutoExpandReplica)
1359+
);
13521360
adminClient.indices().create(request, actionListener);
13531361
}
13541362
}

0 commit comments

Comments
 (0)