Skip to content

Commit

Permalink
auto expand replica 0-2 on custom result index (#1362) (#1364)
Browse files Browse the repository at this point in the history
(cherry picked from commit 5ec87b2)

Signed-off-by: Amit Galitzky <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent f8267b4 commit b2bf944
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 b2bf944

Please sign in to comment.