Skip to content

Commit

Permalink
auto expand replica 0-2 on custom result index (#1362)
Browse files Browse the repository at this point in the history
Signed-off-by: Amit Galitzky <[email protected]>
  • Loading branch information
amitgalitz authored Nov 12, 2024
1 parent f62885a commit 5ec87b2
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ public abstract class IndexManagement<IndexType extends Enum<IndexType> & 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;
Expand Down Expand Up @@ -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);
}
}
Expand Down

0 comments on commit 5ec87b2

Please sign in to comment.