# Elasticsearch Mappings from version 5 to version 7

**URL:** <https://discuss.elastic.co/t/elasticsearch-mappings-from-version-5-to-version-7/280802>\
**Category:** Elasticsearch\
**Tags:** reindex\
**Created:** [August 9, 2021, 11:45am UTC](https://discuss.elastic.co/t/elasticsearch-mappings-from-version-5-to-version-7/280802 "2021-08-09T11:45:16Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![tusharnemade](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@tusharnemade](https://discuss.elastic.co/u/tusharnemade)\
**Post date:** [August 9, 2021, 11:45am UTC](https://discuss.elastic.co/t/elasticsearch-mappings-from-version-5-to-version-7/280802/1 "2021-08-09T11:45:16Z")

</div>

Hello Team

I am using Elasticsearch version 5.6.3 , cluster (A).

I am planning to move to Elasticsearch version 7.8.0 using separate cluster (B) for it.

I am using `_reindex` api to move my index data from A to B cluster and version.

Before using `_reindex` , I am creating Indexes as per Cluster A mapping and Settings.

Could you please help me how should i remove `TYPE NAME` from  
`curl -XGET "localhost:9200/myindex/_mapping" `. output of Elasticsearch version 5.6.3.

As my index creation based on existing mappings with type name is failing due to changes in version 7.8.0

I am looking for some option which should help me do it dynamically and my script could work ...

Could you please help me ...

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [August 10, 2021, 3:42am UTC](https://discuss.elastic.co/t/elasticsearch-mappings-from-version-5-to-version-7/280802/2 "2021-08-10T03:42:25Z")

</div>

> [@tusharnemade](#):
>
> Could you please help me how should i remove `TYPE NAME` from  
> `curl -XGET "localhost:9200/myindex/_mapping" ` . output of Elasticsearch version 5.6.3.

Use `_doc` instead of the original type.

> [@tusharnemade](#):
>
> I am using Elasticsearch version 5.6.3 , cluster (A).
> 
> I am planning to move to Elasticsearch version 7.8.0 using separate cluster (B) for it.

Please do, 5.x has been [EOL](https://www.elastic.co/support/eol) for a number of years. I would suggest going to 7.14 at least though, 7.8 will be EOL at the end of this year.

---

<div class="post-metadata">

**Author:** ![tusharnemade](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@tusharnemade](https://discuss.elastic.co/u/tusharnemade)\
**Post date:** [August 10, 2021, 3:46am UTC](https://discuss.elastic.co/t/elasticsearch-mappings-from-version-5-to-version-7/280802/3 "2021-08-10T03:46:46Z")

</div>

Hi Mark

I understand regarding TYPE changes.

I am asking , How to remove OLD TYPE Name from ES version 5.6.3 while moving to ES Version 7.8.0.

I need to move 100s of indices from OLD version to new version. I have to create mappings .. while creating mappings .. it gives me error message.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [August 10, 2021, 3:52am UTC](https://discuss.elastic.co/t/elasticsearch-mappings-from-version-5-to-version-7/280802/4 "2021-08-10T03:52:53Z")

</div>

> [@tusharnemade](#):
>
> while creating mappings .. it gives me error message.

It'd help if you shared your mapping that is erroring, as well as the error.

---

<div class="post-metadata">

**Author:** ![tusharnemade](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@tusharnemade](https://discuss.elastic.co/u/tusharnemade)\
**Post date:** [August 10, 2021, 4:00am UTC](https://discuss.elastic.co/t/elasticsearch-mappings-from-version-5-to-version-7/280802/5 "2021-08-10T04:00:54Z")

</div>

Below is the statement of mapping and settings derived from existing Index of version 5.6.3

```auto
curl -X PUT "localhost:9200/myindex?pretty" -H 'Content-Type: application/json' -d'
 {
 "settings": {
  "index": {
    "codec": "best_compression",
    "routing": {
      "allocation": {
        "require": {
          "box_type": "warm"
        }
      }
    },
    "number_of_shards": "5",
    "blocks": {
      "read_only_allow_delete": "true"
    }
  }
} ,
 "mappings": {
  "mytype": {
    "properties": {
      "@timestamp": {
        "type": "date"
      },
      "actconn": {
        "type": "text",
...
....

```

ERROR while creating same in Elasticsearch version 7.8.0 ==\>

This is expected as in ES v5.6.3 we have mapping defined as`"mytype"` , while in ES 7.8.0 its removed.

My question is how should i remove "mytype" while getting STATEMENT generated from existing indices of v5.6.3 as `/_mapping` includes TYPE NAME for v5.6.3

```auto
{
  "error" : {
    "root_cause" : [
      {
        "type" : "mapper_parsing_exception",
        "reason" : "Root mapping definition has unsupported parameters: [mytype : {properties={date={type=text, fields={keyword={ignore_above=256, type=keyword}}}, tt={type=text, fields={keyword={ignore_above=256, type=keyword}}}, request={type=text, fields={keyword={ignore_above=256, type=keyword}}}, actconn={type=text, fields={keyword={ignore_above=256, type=keyword}}}, ps={type=text, fields={keyword={ignore_above=256, type=keyword}}}, tw={type=text, fields={keyword={ignore_above=256, type=keyword}}}, srv_conn={type=text, fields={keyword={ignore_above=256, type=keyword}}}, f_end={type=text, fields={keyword={ignore_above=256, type=keyword}}}, pid={type=text, fields={keyword={ignore_above=256, type=keyword}}}, hostname={type=text, fields={keyword={ignore_above=256, type=keyword}}}, beconn={type=text, fields={keyword={ignore_above=256, type=keyword}}}, host={type=text, fields={keyword={ignore_above=256, type=keyword}}}, req_headers={type=text, fields={keyword={ignore_above=256, type=keyword}}}, tag={type=text, fields={keyword={ignore_above=256, type=keyword}}}, b_server={type=text, fields={keyword={ignore_above=256, type=keyword}}}, feconn={type=text, fields={keyword={ignore_above=256, type=keyword}}}, privateip={type=text, fields={keyword={ignore_above=256, type=keyword}}}, srv_queue={type=text, fields={keyword={ignore_above=256, type=keyword}}}, res_cookie={type=text, fields={keyword={ignore_above=256, type=keyword}}}, req_cookie={type=text, fields={keyword={ignore_above=256, type=keyword}}}, c_ip={type=text, fields={keyword={ignore_above=256, type=keyword}}}, b_end={type=text, fields={keyword={ignore_above=256, type=keyword}}}, tc={type=text, fields={keyword={ignore_above=256, type=keyword}}}, backend_queue={type=text, fields={keyword={ignore_above=256, type=keyword}}}, retries={type=text, fields={keyword={ignore_above=256, type=keyword}}}, @timestamp={type=date}, logName={type=text, fields={keyword={ignore_above=256, type=keyword}}}, bytes={type=text, fields={keyword={ignore_above=256, type=keyword}}}, status code={type=text, fields={keyword={ignore_above=256, type=keyword}}}, time={type=text, fields={keyword={ignore_above=256, type=keyword}}}, t_state={type=text, fields={keyword={ignore_above=256, type=keyword}}}, tq={type=text, fields={keyword={ignore_above=256, type=keyword}}}, tr={type=text, fields={keyword={ignore_above=256, type=keyword}}}}}]"
      }
    ],
    "type" : "mapper_parsing_exception",
    "reason" : "Failed to parse mapping [_doc]: Root mapping definition has unsupported parameters: [mytype : {properties={date={type=text, fields={keyword={ignore_above=256, type=keyword}}}, tt={type=text, fields={keyword={ignore_above=256, type=keyword}}}, request={type=text, fields={keyword={ignore_above=256, type=keyword}}}, actconn={type=text, fields={keyword={ignore_above=256, type=keyword}}}, ps={type=text, fields={keyword={ignore_above=256, type=keyword}}}, tw={type=text, fields={keyword={ignore_above=256, type=keyword}}}, srv_conn={type=text, fields={keyword={ignore_above=256, type=keyword}}}, f_end={type=text, fields={keyword={ignore_above=256, type=keyword}}}, pid={type=text, fields={keyword={ignore_above=256, type=keyword}}}, hostname={type=text, fields={keyword={ignore_above=256, type=keyword}}}, beconn={type=text, fields={keyword={ignore_above=256, type=keyword}}}, host={type=text, fields={keyword={ignore_above=256, type=keyword}}}, req_headers={type=text, fields={keyword={ignore_above=256, type=keyword}}}, tag={type=text, fields={keyword={ignore_above=256, type=keyword}}}, b_server={type=text, fields={keyword={ignore_above=256, type=keyword}}}, feconn={type=text, fields={keyword={ignore_above=256, type=keyword}}}, privateip={type=text, fields={keyword={ignore_above=256, type=keyword}}}, srv_queue={type=text, fields={keyword={ignore_above=256, type=keyword}}}, res_cookie={type=text, fields={keyword={ignore_above=256, type=keyword}}}, req_cookie={type=text, fields={keyword={ignore_above=256, type=keyword}}}, c_ip={type=text, fields={keyword={ignore_above=256, type=keyword}}}, b_end={type=text, fields={keyword={ignore_above=256, type=keyword}}}, tc={type=text, fields={keyword={ignore_above=256, type=keyword}}}, backend_queue={type=text, fields={keyword={ignore_above=256, type=keyword}}}, retries={type=text, fields={keyword={ignore_above=256, type=keyword}}}, @timestamp={type=date}, logName={type=text, fields={keyword={ignore_above=256, type=keyword}}}, bytes={type=text, fields={keyword={ignore_above=256, type=keyword}}}, status code={type=text, fields={keyword={ignore_above=256, type=keyword}}}, time={type=text, fields={keyword={ignore_above=256, type=keyword}}}, t_state={type=text, fields={keyword={ignore_above=256, type=keyword}}}, tq={type=text, fields={keyword={ignore_above=256, type=keyword}}}, tr={type=text, fields={keyword={ignore_above=256, type=keyword}}}}}]",
    "caused_by" : {
      "type" : "mapper_parsing_exception",
      "reason" : "Root mapping definition has unsupported parameters: [mytype : {properties={date={type=text, fields={keyword={ignore_above=256, type=keyword}}}, tt={type=text, fields={keyword={ignore_above=256, type=keyword}}}, request={type=text, fields={keyword={ignore_above=256, type=keyword}}}, actconn={type=text, fields={keyword={ignore_above=256, type=keyword}}}, ps={type=text, fields={keyword={ignore_above=256, type=keyword}}}, tw={type=text, fields={keyword={ignore_above=256, type=keyword}}}, srv_conn={type=text, fields={keyword={ignore_above=256, type=keyword}}}, f_end={type=text, fields={keyword={ignore_above=256, type=keyword}}}, pid={type=text, fields={keyword={ignore_above=256, type=keyword}}}, hostname={type=text, fields={keyword={ignore_above=256, type=keyword}}}, beconn={type=text, fields={keyword={ignore_above=256, type=keyword}}}, host={type=text, fields={keyword={ignore_above=256, type=keyword}}}, req_headers={type=text, fields={keyword={ignore_above=256, type=keyword}}}, tag={type=text, fields={keyword={ignore_above=256, type=keyword}}}, b_server={type=text, fields={keyword={ignore_above=256, type=keyword}}}, feconn={type=text, fields={keyword={ignore_above=256, type=keyword}}}, privateip={type=text, fields={keyword={ignore_above=256, type=keyword}}}, srv_queue={type=text, fields={keyword={ignore_above=256, type=keyword}}}, res_cookie={type=text, fields={keyword={ignore_above=256, type=keyword}}}, req_cookie={type=text, fields={keyword={ignore_above=256, type=keyword}}}, c_ip={type=text, fields={keyword={ignore_above=256, type=keyword}}}, b_end={type=text, fields={keyword={ignore_above=256, type=keyword}}}, tc={type=text, fields={keyword={ignore_above=256, type=keyword}}}, backend_queue={type=text, fields={keyword={ignore_above=256, type=keyword}}}, retries={type=text, fields={keyword={ignore_above=256, type=keyword}}}, @timestamp={type=date}, logName={type=text, fields={keyword={ignore_above=256, type=keyword}}}, bytes={type=text, fields={keyword={ignore_above=256, type=keyword}}}, status code={type=text, fields={keyword={ignore_above=256, type=keyword}}}, time={type=text, fields={keyword={ignore_above=256, type=keyword}}}, t_state={type=text, fields={keyword={ignore_above=256, type=keyword}}}, tq={type=text, fields={keyword={ignore_above=256, type=keyword}}}, tr={type=text, fields={keyword={ignore_above=256, type=keyword}}}}}]"
    }
  },
  "status" : 400
}

```

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [August 10, 2021, 4:03am UTC](https://discuss.elastic.co/t/elasticsearch-mappings-from-version-5-to-version-7/280802/6 "2021-08-10T04:03:12Z")

</div>

> [@tusharnemade](#):
>
> ```auto
> "mappings": {
> "mytype": {
> 
> ```

That need to be;

```auto
 "mappings": {
  "_doc": {

```

---

<div class="post-metadata">

**Author:** ![tusharnemade](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@tusharnemade](https://discuss.elastic.co/u/tusharnemade)\
**Post date:** [August 10, 2021, 4:05am UTC](https://discuss.elastic.co/t/elasticsearch-mappings-from-version-5-to-version-7/280802/7 "2021-08-10T04:05:24Z")

</div>

Yes. I understand that ..

How to make it ... as I am having multiple indices ... and multiple types created ...

It would take long long time to remove all types manually and make it \_doc

It would be better to not to include "TYPE NAME " while capturing existing mappings ... from version 5.6.3

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [August 10, 2021, 4:09am UTC](https://discuss.elastic.co/t/elasticsearch-mappings-from-version-5-to-version-7/280802/8 "2021-08-10T04:09:33Z")

</div>

There's nothing in Elasticsearch that will do that.  
You'd need to download the mappings and use a scripting tool to do it.

---

<div class="post-metadata">

**Author:** ![tusharnemade](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@tusharnemade](https://discuss.elastic.co/u/tusharnemade)\
**Post date:** [August 10, 2021, 4:11am UTC](https://discuss.elastic.co/t/elasticsearch-mappings-from-version-5-to-version-7/280802/9 "2021-08-10T04:11:28Z")

</div>

Could you please help me by suggesting tool to ge through it.

I was searching same ... but was not able to get it , hence i raised in here the issue...

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [August 10, 2021, 4:12am UTC](https://discuss.elastic.co/t/elasticsearch-mappings-from-version-5-to-version-7/280802/10 "2021-08-10T04:12:18Z")

</div>

If you download the mappings and save them as json, you could use `sed` to do it on the CLI.

---

<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:** [September 7, 2021, 4:12am UTC](https://discuss.elastic.co/t/elasticsearch-mappings-from-version-5-to-version-7/280802/11 "2021-09-07T04:12:59Z")

</div>

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