Ask for help on the mapping setting of nested nested obj in elasticsearch

paste the document first:

{
    "total": 5,
    "online": [
        {
            "sid": "1101006",
            "total": 0
        },
        {
            "sid": "1101001",
            "total": 2,
            "platform": {
                "Windows_2144": 1,
                "Android_2144szsgnew": 1
            }
        },
        {
            "sid": "1101003",
            "total": 1,
            "platform": {
                "Android_2144szsgnew": 1
            }
        },
        {
            "sid": "1101004",
            "total": 2,
            "platform": {
                "Android_2144szsg": 2
            }
        },
        {
            "sid": "1101002",
            "total": 0
        },
        {
            "sid": "1101005",
            "total": 0
        }
    ],
    "_t": "2018-11-26 00:00:00",
    "groupid": "1101001"
}

I originally designed mapping: with the following structure

{
    "settings": {
        "number_of_shards": 5,
        "number_of_replicas": 0
    },
    "mappings": {
        "doc": {
            "dynamic": true,
            "properties": {
                "total": {
                    "type": "integer"
                },
                "online": {
                    "type": "nested",
                    "properties": {
                        "sid": {
                            "type": "keyword"
                        },
                        "total": {
                            "type": "integer"
                        },
                        "platform": {
                            "dynamic": true,
                            "type": "object"
                        }
                    }
                },
                "_t": {
                    "type": "date",
                    "format": "YYYY-MM-dd HH:mm:ss"
                },
                "groupid": {
                    "type": "keyword"
                }
            }
        }
    }
}

in which the "online" field needs to be set to nested, and then there is a "platform" in the substructure that is an object,. The fields in this structure are not fixed and may increase dynamically, so I want not to write it to death, but directly report the following error when inserting data according to this mapping:

{
    "error": {
        "root_cause": [
            {
                "type": "illegal_argument_exception",
                "reason": "object mapping [online] can"t be changed from nested to non-nested"
            }
        ],
        "type": "illegal_argument_exception",
        "reason": "object mapping [online] can"t be changed from nested to non-nested"
    },
    "status": 400
}

this error can be determined to be the problem of the "platform" field. I would like to ask how to change the mapping in order to insert the data of this structure?

Dec.21,2021
Menu