Elastic search 7.8.0 and multiple geoshapes

Hi,

I have created an index and I put the following mapping:

 {
    "dynamic_templates": [
        {
            "_geo": {
                "match": "*_geo",
                "mapping": {
                    "type": "geo_shape"
                }
            }
        }
    ]
}

then I am attempting to put a document:

{
    "envelope_geo": [
        {
            "type": "envelope",
            "coordinates": [[100.0, 1.0], [101.0, 0.0]]
        },
        {
            "type": "envelope",
            "coordinates": [[100.0, 1.0], [101.0, 0.0]]
        }
    ]
}

It fails with the message:

{
    "error": {
        "root_cause": [
            {
                "type": "parse_exception",
                "reason": "shape must be an object consisting of type and coordinates"
            }
        ],
        "type": "mapper_parsing_exception",
        "reason": "failed to parse field [envelope_geo] of type [geo_shape]",
        "caused_by": {
            "type": "parse_exception",
            "reason": "shape must be an object consisting of type and coordinates"
        }
    },
    "status": 400
}

This sequence described above used to work in previous versions. Now it only accepts a single geoshape (no square brackets), but rejects an array of geoshapes.

Is this expected or is it a bug?

Hi @pandzel,

thank you so much for reporting this finding!

It is not intended, as you assumed. This was an untended bug
due to some internal refactoring.

I've opened a PR to resolve this ASAP https://github.com/elastic/elasticsearch/pull/58786