Currently, when an object is mapped with `subobjects: false`, trying to ingest a document that has nested objects leads to a mapping exception.

In a couple of occasions, we've been talking about that it would be convenient if Elasticsearch could automatically flatten the fields instead of the client having to know about the `subobjects` setting. This would make `subobjects: false` more of a drop-in replacement that allows for a much easier adoption, without changes in the client.

Note that the `_source` should ideally stay untouched, just the stored fields should be flattened automatically.

Some related issues
* https://github.com/elastic/apm/issues/347
* https://github.com/elastic/elasticsearch/issues/88777
* https://github.com/elastic/package-spec/issues/349
server/src/test/java/org/elasticsearch/index/mapper/DocumentParserTests.java
"""));
        assertNoSubobjects(doc);
    }
    private static void assertNoSubobjects(ParsedDocument doc) {
        Mapping mappingsUpdate = doc.dynamicMappingsUpdate();
        assertNotNull(mappingsUpdate);
        Mapper metrics = mappingsUpdate.getRoot().mappers.get("metrics");
        assertThat(metrics, instanceOf(ObjectMapper.class));
        ObjectMapper metricsObject = (ObjectMapper) metrics;
        Mapper service = metricsObject.getMapper("service");
        assertThat(service, instanceOf(ObjectMapper.class));
        ObjectMapper serviceObject = (ObjectMapper) service;
        assertNotNull(serviceObject.getMapper("time"));
        assertNotNull(serviceObject.getMapper("time.max"));
        assertNotNull(serviceObject.getMapper("time.min"));
        assertNotNull(serviceObject.getMapper("test.with.dots"));
        Mapper object = metricsObject.getMapper("object");
        assertThat(object, instanceOf(ObjectMapper.class));
        ObjectMapper objectObject = (ObjectMapper) object;
        Mapper inner = objectObject.getMapper("inner");
        assertThat(inner, instanceOf(ObjectMapper.class));
        ObjectMapper innerObject = (ObjectMapper) inner;
        assertNotNull(innerObject.getMapper("field"));
        assertNotNull(doc.rootDoc().getField("metrics.object.inner.field"));
        assertNotNull(doc.rootDoc().getField("metrics.service.time"));
        assertNotNull(doc.rootDoc().getField("metrics.service.time.max"));
        assertNotNull(doc.rootDoc().getField("metrics.service.time.min"));
        assertNotNull(doc.rootDoc().getField("metrics.service.test.with.dots"));
    }
    public void testSubobjectsFalseArrayOfObject() throws Exception {