Runtime Mapping agg query error

The error looks related to nested field type. There are a couple of workarounds for that. Sharing a similar discussions below.

  1. How to access objects fields nested value in runtime field painless (or expression) scripts?
  2. How to create an array runtime field - #10 by cr_168328
  3. kibana - How to create an array type runtime field based on a nested field in elasticsearch? - Stack Overflow