# Reindex causes mapper\_parsing\_exception

**URL:** <https://discuss.elastic.co/t/reindex-causes-mapper-parsing-exception/217328>\
**Category:** Elasticsearch\
**Created:** [January 31, 2020, 8:59am UTC](https://discuss.elastic.co/t/reindex-causes-mapper-parsing-exception/217328 "2020-01-31T08:59:19Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gavin\_Hardy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gavin_hardy/32/46713_2.png) [@Gavin\_Hardy](https://discuss.elastic.co/u/Gavin_Hardy)\
**Post date:** [January 31, 2020, 8:59am UTC](https://discuss.elastic.co/t/reindex-causes-mapper-parsing-exception/217328/1 "2020-01-31T08:59:19Z")

</div>

Hello,

We are currently using Functionbeat to create our templates, and yesterday we started seeing errors. Looking at the index's that were affected, it appears someone had create a custom template, which caused the errors. So I put the index back to using the original template, and now when I go to reindex the old index, to use the updated template, it is complaining about the following error.

```auto
{
 "source": {
 "index": "is-prod-fb-2020.01.29-000235"
  },
  "dest": {
  "index": "is-prod-fb-2020.01.29-000235-tmp"
  }
}

```

```auto
    {
      "index": "is-fb-2020.01.29-000235-tmp",
      "type": "_doc",
      "id": "cTiX8W8BNtz7_4jyhWdW",
      "cause": {
        "type": "mapper_parsing_exception",
        "reason": "object mapping for [error] tried to parse field [error] as object, but found a concrete value"
      },
      "status": 400
    }
  ]

```

I understand the data inside the index, is of type string, and not object. Which is why it wont index, but my question is, how can I make it index, or change the data to be Object, without losing the index?

Any help is much appreciated!

---

<div class="post-metadata">

**Author:** ![Gavin\_Hardy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gavin_hardy/32/46713_2.png) [@Gavin\_Hardy](https://discuss.elastic.co/u/Gavin_Hardy)\
**Post date:** [January 31, 2020, 9:04am UTC](https://discuss.elastic.co/t/reindex-causes-mapper-parsing-exception/217328/2 "2020-01-31T09:04:56Z")

</div>

Just to add a note, all new shards use the updated template are working as expected, its just 4 shards that are still causing issues due to using the old template.

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [January 31, 2020, 9:09am UTC](https://discuss.elastic.co/t/reindex-causes-mapper-parsing-exception/217328/3 "2020-01-31T09:09:14Z")

</div>

See quick solution is to use [ignore\_malformed](https://www.elastic.co/guide/en/elasticsearch/reference/7.5/ignore-malformed.html) in the mapping so a document gets indexed. However if you are reindexing into a new index, what prevents you from fixing the mapping in that index. I might be missing something there... also if the initial structure is wrong, you can use a script to fix the document structure and move that string based error field somewhere else and then you would end up with clean, searchable data.

---

<div class="post-metadata">

**Author:** ![Gavin\_Hardy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gavin_hardy/32/46713_2.png) [@Gavin\_Hardy](https://discuss.elastic.co/u/Gavin_Hardy)\
**Post date:** [January 31, 2020, 9:21am UTC](https://discuss.elastic.co/t/reindex-causes-mapper-parsing-exception/217328/4 "2020-01-31T09:21:53Z")

</div>

So, when I try to fix the mapping in those index, I get this error

```auto
{
  "properties": {
    "error": {
      "type": "object"
    }
  }
}

```

Which throws this error

```auto
  "error": {
    "root_cause": [
      {
        "type": "remote_transport_exception",
        "reason": "[instance-0000000021][172.17.0.32:19849][indices:admin/mapping/put]"
      }
    ],
    "type": "illegal_argument_exception",
    "reason": "mapper [error] of different type, current_type [text], merged_type [ObjectMapper]"
  },
  "status": 400
}

```

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [January 31, 2020, 9:33am UTC](https://discuss.elastic.co/t/reindex-causes-mapper-parsing-exception/217328/5 "2020-01-31T09:33:19Z")

</div>

you cannot change the mapping field type of an existing index, you need to reindex.

---

<div class="post-metadata">

**Author:** ![Gavin\_Hardy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gavin_hardy/32/46713_2.png) [@Gavin\_Hardy](https://discuss.elastic.co/u/Gavin_Hardy)\
**Post date:** [January 31, 2020, 9:36am UTC](https://discuss.elastic.co/t/reindex-causes-mapper-parsing-exception/217328/6 "2020-01-31T09:36:32Z")

</div>

Then I just get the error above when trying to reindex. Lost at what to do ☹

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [January 31, 2020, 9:48am UTC](https://discuss.elastic.co/t/reindex-causes-mapper-parsing-exception/217328/7 "2020-01-31T09:48:00Z")

</div>

have you created the destination index with your new mapping first and verified that the mapping is what you expect it to be?

---

<div class="post-metadata">

**Author:** ![Gavin\_Hardy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gavin_hardy/32/46713_2.png) [@Gavin\_Hardy](https://discuss.elastic.co/u/Gavin_Hardy)\
**Post date:** [January 31, 2020, 9:50am UTC](https://discuss.elastic.co/t/reindex-causes-mapper-parsing-exception/217328/8 "2020-01-31T09:50:05Z")

</div>

Hey, how do I create a destination index with the new mapping? When I updated the index to use the new template, I forced the index to roll\_over, and confirmed all new shards worked as expected, I just have these 4 shards, that are still using the old template, that are not working.

```auto
POST /is-prod-fb/_rollover 
{
  "conditions": {
    "max_age": "1d",
    "max_size": "1gb"
  }
}

```

---

<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:** [February 28, 2020, 10:00am UTC](https://discuss.elastic.co/t/reindex-causes-mapper-parsing-exception/217328/9 "2020-02-28T10:00:36Z")

</div>

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