elastic / kibana

Your window into the Elastic Stack
https://www.elastic.co/products/kibana
Other
19.64k stars 8.23k forks source link

[epm] child properties of nested objects are not defined in mappings #138596

Open klacabane opened 2 years ago

klacabane commented 2 years ago

Summary

When mapping a nested object in a package's data stream, only the top level object is defined in the mapping and any child properties of that object is discarded. _generateMappings seems to be the function responsible for the translation.

Steps to reproduce the issue

- name: test_nested_fields
  type: nested
  fields:
    - name: first
      type: keyword
Screenshot 2022-08-10 at 22 26 57
klacabane commented 2 years ago

According to these tests this is not the way to define the nested properties. So if we flatten the child property with the dotted syntax the mapping will be correctly created. What's curious is that a mix of nested and flattened properties also works while only nested props don't

# works
- name: test_nested_fields
  type: nested
- name: test_nested_fields.first
  type: keyword
# works
- name: test_nested_fields
  type: nested
  fields:
    - name: second
      type: keyword
- name: test_nested_fields.first
  type: keyword
# does not work
- name: test_nested_fields
  type: nested
  fields:
    - name: first
      type: keyword