Elasticsearch query - extract all fields from complex data type (JSON)

Thanks for the reply Doron.

It works for the simple case but if the JSON is more complicated with nested fields or if the values are not all of the same type it throws the below error:

Mappify/kvgen does not support heterogeneous value types. All values in the input map must be of the same type. The field [field2] has a differing type [Utf8].

Does the “Extract” field function have capability to pick multiple fields from the complex type (JSON) instead of one by one?