# Dynamic template ignoring text-only mapping

**URL:** <https://discuss.elastic.co/t/dynamic-template-ignoring-text-only-mapping/176599>\
**Category:** Elasticsearch\
**Created:** [April 12, 2019, 10:24am UTC](https://discuss.elastic.co/t/dynamic-template-ignoring-text-only-mapping/176599 "2019-04-12T10:24:03Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![WDK](https://avatars.discourse-cdn.com/v4/letter/w/a87d85/32.png) [@WDK](https://discuss.elastic.co/u/WDK)\
**Post date:** [April 12, 2019, 10:24am UTC](https://discuss.elastic.co/t/dynamic-template-ignoring-text-only-mapping/176599/1 "2019-04-12T10:24:03Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [April 12, 2019, 10:38am UTC](https://discuss.elastic.co/t/dynamic-template-ignoring-text-only-mapping/176599/2 "2019-04-12T10:38:29Z")

</div>

How did you register the template ?

---

<div class="post-metadata">

**Author:** ![WDK](https://avatars.discourse-cdn.com/v4/letter/w/a87d85/32.png) [@WDK](https://discuss.elastic.co/u/WDK)\
**Post date:** [April 12, 2019, 10:53am UTC](https://discuss.elastic.co/t/dynamic-template-ignoring-text-only-mapping/176599/3 "2019-04-12T10:53:53Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![WDK](https://avatars.discourse-cdn.com/v4/letter/w/a87d85/32.png) [@WDK](https://discuss.elastic.co/u/WDK)\
**Post date:** [April 12, 2019, 11:26am UTC](https://discuss.elastic.co/t/dynamic-template-ignoring-text-only-mapping/176599/4 "2019-04-12T11:26:28Z")

</div>

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"
    },
```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [May 10, 2019, 11:26am UTC](https://discuss.elastic.co/t/dynamic-template-ignoring-text-only-mapping/176599/5 "2019-05-10T11:26:30Z")

</div>

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