Skip to content

Defining a multi field in a dynamic template matching the new text type doesn't work #16945

@Bargs

Description

@Bargs

Elasticsearch version: 5.0.0 (master)

JVM version: 1.8

OS version: OSX 10.11.3

Description of the problem including expected versus actual behavior:

While updating the Kibana functional tests to deal with the deprecation of the string mapping type, I tried to create a dynamic template matching text fields with a multi-field mapping as suggested in #12394

My dynamic template looks like this:

"dynamic_templates": [{
        "text_fields": {
          "mapping": {
            "type": "text",
            "fields": {
              "raw": {
                "type": "keyword"
              }
            }
          },
          "match_mapping_type": "text",
          "match": "*"
        }
      }]

When posting documents with text fields to this index, the [fieldName].raw field does not get created.

Steps to reproduce:

  1. Create an index with the above dynamic template.
  2. Index a document that has a text field.
  3. Query the field mappings localhost:9200/<index_name>/_mapping/*/field/*?include_defaults=true
  4. Notice that the [fieldName].raw field is missing

I tried the same dynamic template with "match_mapping_type": "*" instead of text, and the raw field appeared as expected. I also tried the same multi field mapping on a regular field instead of a template, and that also worked. So this seems to be a problem with the combination of text fields and dynamic templates in particular.

Metadata

Metadata

Assignees

No one assigned

    Labels

    :Search Foundations/MappingIndex mappings, including merging and defining field types>bugTeam:Search FoundationsMeta label for the Search Foundations team in Elasticsearch

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions