# Type mapping question

**URL:** <https://discuss.elastic.co/t/type-mapping-question/129336>\
**Category:** Elasticsearch\
**Created:** [April 24, 2018, 3:19pm UTC](https://discuss.elastic.co/t/type-mapping-question/129336 "2018-04-24T15:19:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![f26227279](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/f26227279/32/21296_2.png) [@f26227279](https://discuss.elastic.co/u/f26227279)\
**Post date:** [April 24, 2018, 3:19pm UTC](https://discuss.elastic.co/t/type-mapping-question/129336/1 "2018-04-24T15:19:50Z")

</div>

Hi, I collect netflow through logstash, but the IPV4\_ADDR field default type is string. I want to mapping the type into "ip" through the API:

```
PUT _template/logstash
{
  "index_patterns": ["logstash-*"],
  "settings": {
    "number_of_shards": 5
  },
  "mappings": {
    "doc": {
      "_source": {
        "enabled": true
      },
      "properties": {
        "IPV4_SRC_ADDR": { "type": "ip"},
        "IPV4_DST_ADDR": { "type": "ip"},
        "PROTOCOL": { "type": "integer"}
      }
    }
  }
}

```

but the type is still string unless I delete all the data in ES before I request the mapping API, and the type could turn into "ip".  
How could I do to change the type needn't delete all the data?

thank you in advance 🙂

---

<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 22, 2018, 3:19pm UTC](https://discuss.elastic.co/t/type-mapping-question/129336/2 "2018-05-22T15:19:53Z")

</div>

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