diff --git a/src/main/java/org/opensearch/timeseries/indices/IndexManagement.java b/src/main/java/org/opensearch/timeseries/indices/IndexManagement.java index da116b8a7..6e47c8838 100644 --- a/src/main/java/org/opensearch/timeseries/indices/IndexManagement.java +++ b/src/main/java/org/opensearch/timeseries/indices/IndexManagement.java @@ -103,6 +103,7 @@ public abstract class IndexManagement & TimeSe public static final String META = "_meta"; public static final String SCHEMA_VERSION = "schema_version"; + public static final String customResultIndexAutoExpandReplica = "0-2"; protected ClusterService clusterService; protected final Client client; protected final AdminClient adminClient; @@ -1349,6 +1350,13 @@ protected void initResultIndexDirectly( if (defaultResultIndex) { adminClient.indices().create(request, markMappingUpToDate(resultIndex, actionListener)); } else { + request + .settings( + Settings + .builder() + // Support up to 2 replicas at least + .put(IndexMetadata.SETTING_AUTO_EXPAND_REPLICAS, customResultIndexAutoExpandReplica) + ); adminClient.indices().create(request, actionListener); } }