# Elasticsearch add mapping to existing index

**URL:** <https://discuss.elastic.co/t/elasticsearch-add-mapping-to-existing-index/67688>\
**Category:** Elasticsearch\
**Created:** [November 30, 2016, 11:06pm UTC](https://discuss.elastic.co/t/elasticsearch-add-mapping-to-existing-index/67688 "2016-11-30T23:06:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![alexus](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexus/32/12696_2.png) [@alexus](https://discuss.elastic.co/u/alexus)\
**Post date:** [November 30, 2016, 11:06pm UTC](https://discuss.elastic.co/t/elasticsearch-add-mapping-to-existing-index/67688/1 "2016-11-30T23:06:01Z")

</div>

I'm stumble upon [Changing Mapping with Zero Downtime | Elastic](https://www.elastic.co/blog/changing-mapping-with-zero-downtime) blog post, however it's dated back in 2013.

I need to add mapping to existing index, what is the best way to approach this?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![msimos](https://avatars.discourse-cdn.com/v4/letter/m/bb73d2/32.png) [@msimos](https://discuss.elastic.co/u/msimos)\
**Post date:** [November 30, 2016, 11:14pm UTC](https://discuss.elastic.co/t/elasticsearch-add-mapping-to-existing-index/67688/2 "2016-11-30T23:14:19Z")

</div>

Refer to the documentation here on the PUT mapping API:

[https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-put-mapping.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-put-mapping.html)

---

<div class="post-metadata">

**Author:** ![alexus](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexus/32/12696_2.png) [@alexus](https://discuss.elastic.co/u/alexus)\
**Post date:** [December 1, 2016, 5:50pm UTC](https://discuss.elastic.co/t/elasticsearch-add-mapping-to-existing-index/67688/3 "2016-12-01T17:50:38Z")

</div>

I guess, I'm doing something wrong, can't put my finger on it...

delete index:

```
$ curl -XDELETE 0:9200/test?pretty
{
  "acknowledged" : true
}
$ 

```

create index:

```
$ curl -XPUT 0:9200/test?pretty
{
  "acknowledged" : true,
  "shards_acknowledged" : true
}
$

```

create dummy document:

```
$ curl -XPOST 0:9200/test/t?pretty -d '{ "price": 1 }'
{
  "_index" : "test",
  "_type" : "t",
  "_id" : "AVi7cocPMoL1V0O0z0Lk",
  "_version" : 1,
  "result" : "created",
  "_shards" : {
    "total" : 2,
    "successful" : 1,
    "failed" : 0
  },
  "created" : true
}
$

```

get existing mapping:

```
$ curl -XGET 0:9200/test/_mapping?pretty
{
  "test" : {
    "mappings" : {
      "t" : {
        "properties" : {
          "price" : {
            "type" : "long"
          }
        }
      }
    }
  }
}
$ 

```

putting mapping:

```
$ curl -XPUT 0:9200/test/_mapping/t?pretty -d '
{
  "test" : {
    "mappings" : {
      "t" : {
        "properties" : {
          "price": {
            "type": "integer"
          }
        }
      }
    }
  }
}
'
{
  "error" : {
    "root_cause" : [
      {
        "type" : "mapper_parsing_exception",
        "reason" : "Root mapping definition has unsupported parameters: [test : {mappings={t={properties={price={type=integer}}}}}]"
      }
    ],
    "type" : "mapper_parsing_exception",
    "reason" : "Root mapping definition has unsupported parameters: [test : {mappings={t={properties={price={type=integer}}}}}]"
  },
  "status" : 400
}
$ 

```

Please advice.

---

<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 29, 2016, 5:50pm UTC](https://discuss.elastic.co/t/elasticsearch-add-mapping-to-existing-index/67688/4 "2016-12-29T17:50:46Z")

</div>

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