diff --git a/server/src/main/java/org/opensearch/cluster/metadata/MetadataCreateIndexService.java b/server/src/main/java/org/opensearch/cluster/metadata/MetadataCreateIndexService.java index 8d76a39712ee3..954f5e0d3c28b 100644 --- a/server/src/main/java/org/opensearch/cluster/metadata/MetadataCreateIndexService.java +++ b/server/src/main/java/org/opensearch/cluster/metadata/MetadataCreateIndexService.java @@ -63,6 +63,7 @@ import org.opensearch.cluster.service.ClusterService; import org.opensearch.common.Nullable; import org.opensearch.common.Priority; +import org.opensearch.common.Randomness; import org.opensearch.common.UUIDs; import org.opensearch.common.ValidationException; import org.opensearch.common.compress.CompressedXContent; @@ -111,6 +112,7 @@ import java.util.Locale; import java.util.Map; import java.util.Optional; +import java.util.Random; import java.util.Set; import java.util.concurrent.atomic.AtomicInteger; import java.util.function.BiConsumer; @@ -164,6 +166,7 @@ public class MetadataCreateIndexService { private final Set indexSettingProviders = new HashSet<>(); private final ClusterManagerTaskThrottler.ThrottlingKey createIndexTaskKey; private AwarenessReplicaBalance awarenessReplicaBalance; + private static final Random RANDOM_INT_GENERATOR = Randomness.get(); public MetadataCreateIndexService( final Settings settings, @@ -889,7 +892,7 @@ static Settings aggregateIndexSettings( indexSettingsBuilder.put(SETTING_CREATION_DATE, Instant.now().toEpochMilli()); } indexSettingsBuilder.put(IndexMetadata.SETTING_INDEX_PROVIDED_NAME, request.getProvidedName()); - indexSettingsBuilder.put(SETTING_INDEX_UUID, UUIDs.randomBase64UUID()); + indexSettingsBuilder.put(SETTING_INDEX_UUID, Integer.toBinaryString(RANDOM_INT_GENERATOR.nextInt(256)) + UUIDs.randomBase64UUID()); updateReplicationStrategy(indexSettingsBuilder, request.settings(), settings); updateRemoteStoreSettings(indexSettingsBuilder, settings);