Dynamic template ignoring text-only mapping

I'm constructing a dynamic template that removes the keyword mapping for values in Elasticsearch 7.0.0.

My template:

mappings": {
  "dynamic_templates": [
    {
      "string_to_text": {
        "mapping": {
          "type": "text"
        },
        "match_mapping_type": "string"
      }
    }
  ]
}

The data I push:

PUT /test/_doc/1
{
  "Program": "aprogram"
}

The result:

"mappings" : {
  "properties" : {
    "Program" : {
      "type" : "text",
      "fields" : {
        "keyword" : {
          "type" : "keyword",
          "ignore_above" : 256
        }
      }
    }
  }
}

I would expect the Program field to be text only but it seems it also gets the keyword type.

When I test this on our production cluster on version 6.7.0, I get the expected result: the program field is text only.

How did you register the template ?

I added it via the Dev Tools ui on both clusters.

The weirdest part: I continued adding real data from a log file (pushed by filebeat through logstash) instead of pushing it from the dev tools, and now the template seems to have picked it up:

    "Program" : {
      "type" : "text"
    },

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.