How to manage array with dynamic_templates

hello,
i want to use dynamic mapping an manage array of object by making them defined as arrays.
it works when i define the field directly:

"tx.chargingSessionEvents": {
          "type": "nested"
        },

but i would like elasticsearch to detect arrays and use nested automatically.
I've tried something like that :

"dynamic_templates": [
        {
          "Arrays": {
            "match_mapping_type": "array",
            "mapping": {
              "type": "nested"
            }
          }
        }
]

i thought i would work considering this part of the documentation
And using the java client i got this error:
No field type matched on [array], possible values are [object, string, long, double, boolean, date, binary]

Am i missing something or is there a kind of limitation i didn't thought about ?

Bonjour Julien :wink:

No I don't think it's possible actually.

1 Like

There is no dedicated array datatype in Elasticsearch, that's why you got that error.

You will need to use explict mapping in this case.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.