# Remapping Property Types

**URL:** <https://discuss.elastic.co/t/remapping-property-types/80392>\
**Category:** Elasticsearch\
**Created:** [March 29, 2017, 1:09am UTC](https://discuss.elastic.co/t/remapping-property-types/80392 "2017-03-29T01:09:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jitran](https://avatars.discourse-cdn.com/v4/letter/j/258eb7/32.png) [@jitran](https://discuss.elastic.co/u/jitran)\
**Post date:** [March 29, 2017, 1:09am UTC](https://discuss.elastic.co/t/remapping-property-types/80392/1 "2017-03-29T01:09:51Z")

</div>

We're shipping logs to AWS Elasticsearch 5.1 using Fluentd. By default, most of our log properties are dynamically mapped to the string type. The Fluentd log collector does not let us define the mapping. It seems once the mapping has been created, it's not possible to change the type to an integer.

Here's our mapping:

```auto
{
  "logstash-2017.03.28": {
    "aliases": {},
    "mappings": {
      "fluentd": {
        "properties": {
          ...
          "code": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 256
              }
            }
          },
          ...
        }
      }
    },
    "settings": {
    ..
    }
  }
}

```

Trying to use PUT to remap a property:

```auto
PUT logstash-2017.03.28/_mapping/fluentd
{
  "properties": {
    "code": {
      "type": "integer"
    }
  }
}

```

Error:

```auto
{
  "error": {
    "root_cause": [
      {
        "type": "remote_transport_exception",
        "reason": "[CdG6KXq][x.x.x.x:9300][indices:admin/mapping/put]"
      }
    ],
    "type": "illegal_argument_exception",
    "reason": "mapper [code] of different type, current_type [text], merged_type [integer]"
  },
  "status": 400
}

```

With the Elasticsearch 2.x series it was possible to remap the property types. Is there a way to do this with ES 5.X ? Is there a way to configure ES to always set a particular property to a specific type?

Thanks

---

<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:** [March 29, 2017, 5:30am UTC](https://discuss.elastic.co/t/remapping-property-types/80392/2 "2017-03-29T05:30:00Z")

</div>

You need to change the mapping at index creation time. You can't change an existing field.  
I'd suggest to add a template which does that.

Templates are merged at index creation time.

---

<div class="post-metadata">

**Author:** ![jitran](https://avatars.discourse-cdn.com/v4/letter/j/258eb7/32.png) [@jitran](https://discuss.elastic.co/u/jitran)\
**Post date:** [March 29, 2017, 5:52am UTC](https://discuss.elastic.co/t/remapping-property-types/80392/3 "2017-03-29T05:52:47Z")

</div>

Thanks David.

The FluentD documentation suggests that too [https://github.com/uken/fluent-plugin-elasticsearch#index-templates](https://github.com/uken/fluent-plugin-elasticsearch#index-templates).

---

<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:** [April 26, 2017, 5:52am UTC](https://discuss.elastic.co/t/remapping-property-types/80392/4 "2017-04-26T05:52:54Z")

</div>

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