# "Unable to upgrade the mappings for the index" error when migrating index from 1.x to 2.x

**URL:** <https://discuss.elastic.co/t/unable-to-upgrade-the-mappings-for-the-index-error-when-migrating-index-from-1-x-to-2-x/63305>\
**Category:** Elasticsearch\
**Created:** [October 18, 2016, 2:35pm UTC](https://discuss.elastic.co/t/unable-to-upgrade-the-mappings-for-the-index-error-when-migrating-index-from-1-x-to-2-x/63305 "2016-10-18T14:35:25Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![sloniki](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sloniki/32/12570_2.png) [@sloniki](https://discuss.elastic.co/u/sloniki)\
**Post date:** [October 18, 2016, 2:35pm UTC](https://discuss.elastic.co/t/unable-to-upgrade-the-mappings-for-the-index-error-when-migrating-index-from-1-x-to-2-x/63305/1 "2016-10-18T14:35:25Z")

</div>

I'm trying to snapshot an index in 1.7.2 and restore it in another cluster 2.4.0.  
Snapshot created successfully and "published" as URL. When I try to restore on the new cluster I get:

_{_  
\_ "error": {\_  
\_ "root\_cause": [\_  
\_ {\_  
\_ "type": "snapshot\_restore\_exception",\_  
\_ "reason": **"[test\_restore:snapshot1] cannot restore index [logstash-2016.10.11] because it cannot be upgraded"**\_  
\_ }\_  
\_ ],\_  
\_ "type": "snapshot\_restore\_exception",\_  
\_ "reason": "[test\_restore:snapshot1] cannot restore index [logstash-2016.10.11] because it cannot be upgraded",\_  
\_ "caused\_by": {\_  
\_ "type": "illegal\_state\_exception",\_  
\_ "reason": "unable to upgrade the mappings for the index [logstash-2016.10.11], reason: [mapper [timestamp] cannot be changed from type [string] to [date]]",\_  
\_ "caused\_by": {\_  
\_ "type": "illegal\_argument\_exception",\_  
\_ "reason": "mapper [timestamp] cannot be changed from type [string] to [date]"\_  
\_ }\_  
\_ }\_  
\_ },\_  
\_ "status": 500\_  
_}_

**I ran migration checker for the index on the old cluster and it reports that everithing is green.**

Old and new clusters configured very similar to ingest logs from logstash. If I look into documents in old and new cluster I don't see significant difference, example:

From old:

"\_source": {  
...  
"@timestamp": "2016-10-18T14:00:38.486Z",  
...  
"fields": {  
"@timestamp": [  
1476799238486  
]

From new:

"\_source": {  
...  
"@timestamp": "2016-10-18T13:26:26.247Z",  
...  
"fields": {  
"@timestamp": [  
1476797186247  
]

As I understood from other posts, I will need to reindex, so this seems like a migration checker issue, it didn't identify the issue...

---

<div class="post-metadata">

**Author:** ![MarkOStewart](https://avatars.discourse-cdn.com/v4/letter/m/898d66/32.png) [@MarkOStewart](https://discuss.elastic.co/u/MarkOStewart)\
**Post date:** [October 19, 2016, 10:07pm UTC](https://discuss.elastic.co/t/unable-to-upgrade-the-mappings-for-the-index-error-when-migrating-index-from-1-x-to-2-x/63305/2 "2016-10-19T22:07:38Z")

</div>

try to stream it from one to the other with stream2es. If a valid template is setup on your target it will stream in and take the new schema.

---

<div class="post-metadata">

**Author:** ![polyfractal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/polyfractal/32/48162_2.png) [@polyfractal](https://discuss.elastic.co/u/polyfractal)\
**Post date:** [October 19, 2016, 10:24pm UTC](https://discuss.elastic.co/t/unable-to-upgrade-the-mappings-for-the-index-error-when-migrating-index-from-1-x-to-2-x/63305/3 "2016-10-19T22:24:45Z")

</div>

Can you paste the `GET /logstash-2016.10.11/_mapping` output from your old 1.7.2 cluster?

I suspect the timestamp field is not actually a date, but rather a string. If that's true, the input data is actually a string and not directly upgradeable to a date.

---

<div class="post-metadata">

**Author:** ![sloniki](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sloniki/32/12570_2.png) [@sloniki](https://discuss.elastic.co/u/sloniki)\
**Post date:** [October 20, 2016, 12:09pm UTC](https://discuss.elastic.co/t/unable-to-upgrade-the-mappings-for-the-index-error-when-migrating-index-from-1-x-to-2-x/63305/4 "2016-10-20T12:09:47Z")

</div>

logstash-2016.10.11 has been already deleted. I'm checking on another indices. I ran migration checker on two indices logstash-2016.10.17 and logstash-2016.10.19. The first one is OK (and migration itself was successful!), for the second I do got a warning:  
**Conflicting field mappings**  
**Mapping for field log:timestamp conflicts with: syslog:timestamp. Check parameters: format, norms.enabled, type**

Here are snippets for mapping.

========= for logstash-2016.10.17 =============

## grep -C 3 timestamp mapping17.json "enabled" : true }, "properties" : { "@timestamp" : { "type" : "date", "format" : "dateOptionalTime" },

```
      "enabled" : true
    },
    "properties" : {
      "@timestamp" : {
        "type" : "date",
        "format" : "dateOptionalTime"
      },

```

## -- } } }, "timestamp" : { "type" : "string", "norms" : { "enabled" : false

```
      "enabled" : true
    },
    "properties" : {
      "@timestamp" : {
        "type" : "date",
        "format" : "dateOptionalTime"
      },

```

========= for mapping19.json =========

## grep -C 3 timestamp mapping19.json "enabled" : true }, "properties" : { "@timestamp" : { "type" : "date", "format" : "dateOptionalTime" },

```
          }
        }
      },
      "timestamp" : {
        "type" : "date",
        "format" : "dateOptionalTime"
      },

```

## -- "enabled" : true }, "properties" : { "@timestamp" : { "type" : "date", "format" : "dateOptionalTime" },

```
          }
        }
      },
      "timestamp" : {
        "type" : "string",
        "norms" : {
          "enabled" : false

```

--  
"enabled" : true  
},  
"properties" : {  
"@timestamp" : {  
"type" : "date",  
"format" : "dateOptionalTime"  
},

---

<div class="post-metadata">

**Author:** ![polyfractal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/polyfractal/32/48162_2.png) [@polyfractal](https://discuss.elastic.co/u/polyfractal)\
**Post date:** [October 20, 2016, 1:00pm UTC](https://discuss.elastic.co/t/unable-to-upgrade-the-mappings-for-the-index-error-when-migrating-index-from-1-x-to-2-x/63305/5 "2016-10-20T13:00:05Z")

</div>

Could you gist the entire response up somewhere (I usually use [Github's Gist service](https://gist.github.com/))? Hard to read with individual snippets, not enough context 🙂

It _looks_ like one of the `"timestamp"` fields is a string with norms enabled, while another is just a date, which is causing the exception. But importantly, they appear to be in different types (which is what's causing the error message `"log:timestamp conflicts with: syslog:timestamp."`), but in the same index. In ES 2.x+, types are no longer allowed to have conflicting mappings.

You can read more about that here:

- [https://www.elastic.co/guide/en/elasticsearch/reference/current/breaking\_20\_mapping\_changes.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/breaking_20_mapping_changes.html)
- [https://www.elastic.co/blog/great-mapping-refactoring#conflicting-mappings](https://www.elastic.co/blog/great-mapping-refactoring#conflicting-mappings)

Again, I'm not positive (would need to see the entire mapping in context to be sure), but that looks like a potential problem. So you'll need to verify that any types in a single index have a unified, non-conflicting mapping.

---

<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:** [July 5, 2017, 10:10pm UTC](https://discuss.elastic.co/t/unable-to-upgrade-the-mappings-for-the-index-error-when-migrating-index-from-1-x-to-2-x/63305/6 "2017-07-05T22:10:50Z")

</div>


