elastic / kibana

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

[Index Management][Mappings editor] Remove `fields` property if all multi-fields deleted #178335

Open yuliacech opened 8 months ago

yuliacech commented 8 months ago

When a mapping field is using multi-fields, this data is stored in the fields property. When all multi-fields are deleted from a field, this property still contains an empty object. We need to update the serialization function for the mappings to remove the property if the field doesn't have any multi-fields.

How to reproduce

  1. Create a component template with multi-fields
    PUT _component_template/template_1
    {
    "template": {
    "mappings": {
      "properties": {
        "command_line": {
          "fields": {
            "text": {
              "type": "match_only_text"
            }
          },
          "type": "wildcard"
        }
      }
    }
    }
    }
  2. Navigate to Index Management -> Component templates and find the create component template
  3. Navigate to the Mappings step in the wizard and remove the field text from the field command_line
  4. Save the component template and open the details flyout
  5. Check the Mappings tab Screenshot 2024-03-08 at 17 54 51
elasticmachine commented 8 months ago

Pinging @elastic/platform-deployment-management (Team:Deployment Management)

elasticmachine commented 1 month ago

Pinging @elastic/kibana-management (Team:Kibana Management)