How to dynamic template a mapping for a dictionary object with strict_allow_templates on OpenSearch

I’m creating an index that should be strict_allow_templates to avoid introduction of errors on the mapping, one of the fields should be an object representing a dictionary with IDs as key with the following json representation as example:

"dict": {
    "146": "lorem ipsum dolum",
    "23297030": "",
    "20454962": "ipsum dolor sit amet"
}

The dictionary may have any number of “long” type keys with string values.

With this objective in mind I wrote the following dynamic template, using path_match (that I understood to be the tool for this kind of inner object scenario):

{
    fields: {
        mapping: {
            type: 'text'
        },
        match_mapping_type: 'string',
        path_match: 'dict.\\d{1,19}$',
    }
}

but when trying to index it I get an error:

strict_dynamic_mapping_exception: [strict_dynamic_mapping_exception] Reason: mapping set to strict_allow_templates, dynamic introduction of [dict] within [_doc] is not allowed

I fear that introducing the object on the mapping properties will open the possibility for malformed objects on the document.

What would be the correct way to build a dynamic template for accepting objects with dynamic fields that follow a naming pattern?

I spotted an issue that did not solve the problem but is related, the dynamic template was missing the field match_pattern setting the pattern to regex, the correct version follows:

fields: {
    mapping: {
        type: 'text'
    },
    match_mapping_type: 'string',
    match_pattern: 'regex',
    path_match: 'dict.*',
    match: '^\\d{1,19}$'
}

in addition to this dynamic template correction I needed to introduce the following to my mapping.properties:

dict: { type: 'object' },

in my tests this accepts the digit fields and reject non-digit ones, solving the problem, but also accept empty dict, which is not ideal.