**Build scan:**
https://gradle-enterprise.elastic.co/s/tmjq2blefscrs/tests/:x-pack:plugin:data-streams:internalClusterTest/org.elasticsearch.datastreams.DataStreamIT/testRandomDataSteamAliasesUpdate

**Reproduction line:**
`./gradlew ':x-pack:plugin:data-streams:internalClusterTest' --tests "org.elasticsearch.datastreams.DataStreamIT.testRandomDataSteamAliasesUpdate" -Dtests.seed=F5D48CD0BE369187 -Dbuild.snapshot=false -Dtests.jvm.argline="-Dbuild.snapshot=false" -Dtests.locale=ca-ES -Dtests.timezone=Europe/Oslo -Druntime.java=8`

**Applicable branches:**
7.17

**Reproduces locally?:**
Didn't try

**Failure history:**
https://gradle-enterprise.elastic.co/scans/tests?tests.container=org.elasticsearch.datastreams.DataStreamIT&tests.test=testRandomDataSteamAliasesUpdate

**Failure excerpt:**
```
java.util.concurrent.ExecutionException: ResourceAlreadyExistsException[data_stream [log-onjn] already exists]

  at __randomizedtesting.SeedInfo.seed([F5D48CD0BE369187:173B683B8FD4CEF2]:0)
  at org.elasticsearch.common.util.concurrent.BaseFuture$Sync.getValue(BaseFuture.java:257)
  at org.elasticsearch.common.util.concurrent.BaseFuture$Sync.get(BaseFuture.java:244)
  at org.elasticsearch.common.util.concurrent.BaseFuture.get(BaseFuture.java:75)
  at org.elasticsearch.datastreams.DataStreamIT.testRandomDataSteamAliasesUpdate(DataStreamIT.java:820)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethodAccessorImpl.java:-2)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:498)
  at com.carrotsearch.randomizedtesting.RandomizedRunner.invoke(RandomizedRunner.java:1750)
  at com.carrotsearch.randomizedtesting.RandomizedRunner$8.evaluate(RandomizedRunner.java:938)
  at com.carrotsearch.randomizedtesting.RandomizedRunner$9.evaluate(RandomizedRunner.java:974)
  at com.carrotsearch.randomizedtesting.RandomizedRunner$10.evaluate(RandomizedRunner.java:988)
  at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
  at org.apache.lucene.util.TestRuleSetupTeardownChained$1.evaluate(TestRuleSetupTeardownChained.java:49)
  at org.apache.lucene.util.AbstractBeforeAfterRule$1.evaluate(AbstractBeforeAfterRule.java:45)
  at org.apache.lucene.util.TestRuleThreadAndTestName$1.evaluate(TestRuleThreadAndTestName.java:48)
  at org.apache.lucene.util.TestRuleIgnoreAfterMaxFailures$1.evaluate(TestRuleIgnoreAfterMaxFailures.java:64)
  at org.apache.lucene.util.TestRuleMarkFailure$1.evaluate(TestRuleMarkFailure.java:47)
  at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
  at com.carrotsearch.randomizedtesting.ThreadLeakControl$StatementRunner.run(ThreadLeakControl.java:368)
  at com.carrotsearch.randomizedtesting.ThreadLeakControl.forkTimeoutingTask(ThreadLeakControl.java:817)
  at com.carrotsearch.randomizedtesting.ThreadLeakControl$3.evaluate(ThreadLeakControl.java:468)
  at com.carrotsearch.randomizedtesting.RandomizedRunner.runSingleTest(RandomizedRunner.java:947)
  at com.carrotsearch.randomizedtesting.RandomizedRunner$5.evaluate(RandomizedRunner.java:832)
  at com.carrotsearch.randomizedtesting.RandomizedRunner$6.evaluate(RandomizedRunner.java:883)
  at com.carrotsearch.randomizedtesting.RandomizedRunner$7.evaluate(RandomizedRunner.java:894)
  at org.apache.lucene.util.AbstractBeforeAfterRule$1.evaluate(AbstractBeforeAfterRule.java:45)
  at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
  at org.apache.lucene.util.TestRuleStoreClassName$1.evaluate(TestRuleStoreClassName.java:41)
  at com.carrotsearch.randomizedtesting.rules.NoShadowingOrOverridesOnMethodsRule$1.evaluate(NoShadowingOrOverridesOnMethodsRule.java:40)
  at com.carrotsearch.randomizedtesting.rules.NoShadowingOrOverridesOnMethodsRule$1.evaluate(NoShadowingOrOverridesOnMethodsRule.java:40)
  at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
  at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
  at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
  at org.apache.lucene.util.TestRuleAssertionsRequired$1.evaluate(TestRuleAssertionsRequired.java:53)
  at org.apache.lucene.util.TestRuleMarkFailure$1.evaluate(TestRuleMarkFailure.java:47)
  at org.apache.lucene.util.TestRuleIgnoreAfterMaxFailures$1.evaluate(TestRuleIgnoreAfterMaxFailures.java:64)
  at org.apache.lucene.util.TestRuleIgnoreTestSuites$1.evaluate(TestRuleIgnoreTestSuites.java:54)
  at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
  at com.carrotsearch.randomizedtesting.ThreadLeakControl$StatementRunner.run(ThreadLeakControl.java:368)
  at java.lang.Thread.run(Thread.java:748)

  Caused by: org.elasticsearch.ResourceAlreadyExistsException: data_stream [log-onjn] already exists

    at org.elasticsearch.cluster.metadata.MetadataCreateDataStreamService.createDataStream(MetadataCreateDataStreamService.java:181)
    at org.elasticsearch.cluster.metadata.MetadataCreateDataStreamService.createDataStream(MetadataCreateDataStreamService.java:147)
    at org.elasticsearch.cluster.metadata.MetadataCreateDataStreamService$1.execute(MetadataCreateDataStreamService.java:87)
    at org.elasticsearch.cluster.ClusterStateUpdateTask.execute(ClusterStateUpdateTask.java:51)
    at org.elasticsearch.cluster.service.MasterService.executeTasks(MasterService.java:840)
    at org.elasticsearch.cluster.service.MasterService.calculateTaskOutputs(MasterService.java:407)
    at org.elasticsearch.cluster.service.MasterService.runTasks(MasterService.java:243)
    at org.elasticsearch.cluster.service.MasterService.access$100(MasterService.java:63)
    at org.elasticsearch.cluster.service.MasterService$Batcher.run(MasterService.java:170)
    at org.elasticsearch.cluster.service.TaskBatcher.runIfNotProcessed(TaskBatcher.java:146)
    at org.elasticsearch.cluster.service.TaskBatcher$BatchedTask.run(TaskBatcher.java:202)
    at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:718)
    at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.runAndClean(PrioritizedEsThreadPoolExecutor.java:262)
    at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.run(PrioritizedEsThreadPoolExecutor.java:225)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

```
modules/data-streams/src/internalClusterTest/java/org/elasticsearch/datastreams/DataStreamIT.java
shardCount++;
        }
        final IndexMetadata writeIndexMetadata = clusterState.metadata().index(dataStream.getWriteIndex());
        final OptionalLong forecastedShardSizeInBytes = writeIndexMetadata.getForecastedShardSizeInBytes();
        assertThat(forecastedShardSizeInBytes.isPresent(), is(equalTo(true)));
        assertThat(forecastedShardSizeInBytes.getAsLong(), is(equalTo(expectedTotalSizeInBytes / shardCount)));
    }
    private void indexDocsAndEnsureThereIsCapturedWriteLoad(String dataStreamName) throws Exception {
        assertBusy(() -> {
            for (int i = 0; i < 10; i++) {
                indexDocs(dataStreamName, randomIntBetween(100, 200));
            }
            final ClusterState clusterState = internalCluster().getCurrentMasterNodeInstance(ClusterService.class).state();
            final DataStream dataStream = clusterState.getMetadata().dataStreams().get(dataStreamName);
            final String writeIndex = dataStream.getWriteIndex().getName();
            final IndicesStatsResponse indicesStatsResponse = client().admin().indices().prepareStats(writeIndex).get();
            for (IndexShardStats indexShardStats : indicesStatsResponse.getIndex(writeIndex).getIndexShards().values()) {
                for (ShardStats shard : indexShardStats.getShards()) {
                    final IndexingStats.Stats shardIndexingStats = shard.getStats().getIndexing().getTotal();
                    
                    assertThat(shardIndexingStats.getTotalActiveTimeInMillis(), is(greaterThan(0L)));
                    assertThat(shardIndexingStats.getWriteLoad(), is(greaterThan(0.0)));
                }
            }
        });
    }
    static void putComposableIndexTemplate(
        String id,
        @Nullable String mappings,
        List<String> patterns,