Looks like https://github.com/elastic/elasticsearch/issues/37898 but that issue has been closed for years so I'm opening a fresh one.

**Build scan:**
https://gradle-enterprise.elastic.co/s/apnlznuk3yp5q/tests/:server:internalClusterTest/org.elasticsearch.index.mapper.DynamicMappingIT/testConflictingDynamicMappings

**Reproduction line:**
```
./gradlew ':server:internalClusterTest' --tests "org.elasticsearch.index.mapper.DynamicMappingIT.testConflictingDynamicMappings" -Dtests.seed=20124EB0BA787503 -Dtests.locale=ar-YE -Dtests.timezone=Atlantic/Cape_Verde -Druntime.java=20
```

**Applicable branches:**
main

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

**Failure history:**
https://gradle-enterprise.elastic.co/scans/tests?tests.container=org.elasticsearch.index.mapper.DynamicMappingIT&tests.test=testConflictingDynamicMappings

**Failure excerpt:**
```
java.lang.IllegalArgumentException: mapper [foo] cannot be changed from type [long] to [text]

  at __randomizedtesting.SeedInfo.seed([20124EB0BA787503:42F708BE625A906B]:0)
  at org.elasticsearch.index.mapper.FieldMapper.checkIncomingMergeType(FieldMapper.java:377)
  at org.elasticsearch.index.mapper.FieldMapper.merge(FieldMapper.java:362)
  at org.elasticsearch.index.mapper.FieldMapper.merge(FieldMapper.java:57)
  at org.elasticsearch.index.mapper.ObjectMapper.doMerge(ObjectMapper.java:515)
  at org.elasticsearch.index.mapper.RootObjectMapper.doMerge(RootObjectMapper.java:213)
  at org.elasticsearch.index.mapper.ObjectMapper.merge(ObjectMapper.java:467)
  at org.elasticsearch.index.mapper.RootObjectMapper.merge(RootObjectMapper.java:208)
  at org.elasticsearch.index.mapper.Mapping.merge(Mapping.java:139)
  at org.elasticsearch.index.mapper.MapperService.mergeMappings(MapperService.java:366)
  at org.elasticsearch.index.mapper.MapperService.merge(MapperService.java:334)
  at org.elasticsearch.action.bulk.TransportShardBulkAction.executeBulkItemRequest(TransportShardBulkAction.java:368)
  at org.elasticsearch.action.bulk.TransportShardBulkAction$2.doRun(TransportShardBulkAction.java:219)
  at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26)
  at org.elasticsearch.action.bulk.TransportShardBulkAction.performOnPrimary(TransportShardBulkAction.java:286)
  at org.elasticsearch.action.bulk.TransportShardBulkAction.dispatchedShardOperationOnPrimary(TransportShardBulkAction.java:137)
  at org.elasticsearch.action.bulk.TransportShardBulkAction.dispatchedShardOperationOnPrimary(TransportShardBulkAction.java:74)
  at org.elasticsearch.action.support.replication.TransportWriteAction$1.doRun(TransportWriteAction.java:214)
  at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:983)
  at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
  at java.lang.Thread.run(Thread.java:1623)

```
server/src/internalClusterTest/java/org/elasticsearch/index/mapper/DynamicMappingIT.java
}""").get());
        IndexRequest request = new IndexRequest("test").setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)
            .source(
                "foo.metrics.host.name",
                "localhost",
                "foo.metrics.host.id",
                111,
                "foo.metrics.time",
                100,
                "foo.metrics.time.max",
                1000
            );
        IndexResponse indexResponse = client().index(request).actionGet();
        assertEquals(RestStatus.CREATED, indexResponse.status());
        assertBusy(() -> {
            Map<String, Object> mappings = client().admin().indices().prepareGetMappings("test").get().mappings().get("test").sourceAsMap();
            Map<String, Object> properties = (Map<String, Object>) mappings.get("properties");
            Map<String, Object> foo = (Map<String, Object>) properties.get("foo");
            properties = (Map<String, Object>) foo.get("properties");
            Map<String, Object> metrics = (Map<String, Object>) properties.get("metrics");
            properties = (Map<String, Object>) metrics.get("properties");
            assertEquals(4, properties.size());
            assertNotNull(properties.get("host.name"));
            assertNotNull(properties.get("host.id"));
            assertNotNull(properties.get("time"));
            assertNotNull(properties.get("time.max"));
        });
    }
}