# Logstash 6.4.2 template mapping does not working

**URL:** <https://discuss.elastic.co/t/logstash-6-4-2-template-mapping-does-not-working/155706>\
**Category:** Logstash\
**Created:** [November 7, 2018, 11:40am UTC](https://discuss.elastic.co/t/logstash-6-4-2-template-mapping-does-not-working/155706 "2018-11-07T11:40:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gogua](https://avatars.discourse-cdn.com/v4/letter/g/8491ac/32.png) [@gogua](https://discuss.elastic.co/u/gogua)\
**Post date:** [November 7, 2018, 11:40am UTC](https://discuss.elastic.co/t/logstash-6-4-2-template-mapping-does-not-working/155706/1 "2018-11-07T11:40:56Z")

</div>

i have custom [template mapping](https://pastebin.com/PRyN2Dtf), but when the new index is created dynamically by logstash, [index mapping](https://pastebin.com/U61YFs9q) is wrong, it differs from my template mappings and why?

**Logstash Config**

```
output {
    elasticsearch {
      hosts => ["localhost:9200"]
      index => "nginx_access_%{+YYYY-MM-dd}"
      template => "template_mapping.json"
      template_name => "es_fields_mapping"
      template_overwrite => true
      manage_template => true
    }
}

```

why fields(bytes, geoip.ip and etc) type is text? what is wrong?  
example:

**bytes field mapping**

```
"bytes" : {
    "type" : "text",
       "fields" : {
         "keyword" : {
            "type" : "keyword",
            "ignore_above" : 256
        }
     }
  }

```

**geoip.ip**

```
"geoip" : {
  "properties" : {
    "ip" : {
      "type" : "text",
      "fields" : {
        "keyword" : {
          "type" : "keyword",
          "ignore_above" : 256
        }
      }
    }
  }
}

```

why? what is the solution? how can i configure logstash and elasticsearch?

---

<div class="post-metadata">

**Author:** ![AquaX](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aquax/32/92006_2.png) [@AquaX](https://discuss.elastic.co/u/AquaX)\
**Post date:** [November 9, 2018, 7:45pm UTC](https://discuss.elastic.co/t/logstash-6-4-2-template-mapping-does-not-working/155706/2 "2018-11-09T19:45:57Z")

</div>

You have to delete your index if you've defined a template after you first ingested data. You cannot change the template of an index. I suspect that is what has happened.

---

<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:** [December 7, 2018, 7:46pm UTC](https://discuss.elastic.co/t/logstash-6-4-2-template-mapping-does-not-working/155706/3 "2018-12-07T19:46:03Z")

</div>

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