As the title says. These tasks should be batched because they can arise from ILM actions.

Relates #77466
server/src/test/java/org/elasticsearch/cluster/metadata/MetadataIndexAliasesServiceTests.java
)
        );
        assertThat(result.metadata().dataStreamAliases().get("foobar"), notNullValue());
        assertThat(
            result.metadata().dataStreamAliases().get("foobar").getDataStreams(),
            containsInAnyOrder("logs-foobar", "metrics-foobar")
        );
        result = service.applyAliasActions(result, List.of(new AliasAction.RemoveDataStreamAlias("foobar", "logs-foobar", null)));
        assertThat(result.metadata().dataStreamAliases().get("foobar"), notNullValue());
        assertThat(result.metadata().dataStreamAliases().get("foobar").getDataStreams(), containsInAnyOrder("metrics-foobar"));
        result = service.applyAliasActions(result, List.of(new AliasAction.RemoveDataStreamAlias("foobar", "metrics-foobar", null)));
        assertThat(result.metadata().dataStreamAliases().get("foobar"), nullValue());
    }
    public void testDataStreamAliasesWithWriteFlag() {
        ClusterState state = DataStreamTestHelper.getClusterStateWithDataStreams(
            List.of(new Tuple<>("logs-http-emea", 1), new Tuple<>("logs-http-nasa", 1)),
            List.of()
        );
        ClusterState result = service.applyAliasActions(
            state,
            List.of(
                new AliasAction.AddDataStreamAlias("logs-http", "logs-http-emea", true, null),
                new AliasAction.AddDataStreamAlias("logs-http", "logs-http-nasa", null, null)
            )
        );
        assertThat(result.metadata().dataStreamAliases().get("logs-http"), notNullValue());
        assertThat(
            result.metadata().dataStreamAliases().get("logs-http").getDataStreams(),
            containsInAnyOrder("logs-http-nasa", "logs-http-emea")
        );