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.