# \[mapper\_parsing\_exception\] when creating the same document with different type

**URL:** <https://discuss.elastic.co/t/mapper-parsing-exception-when-creating-the-same-document-with-different-type/82987>\
**Category:** Elasticsearch\
**Created:** [April 20, 2017, 6:43am UTC](https://discuss.elastic.co/t/mapper-parsing-exception-when-creating-the-same-document-with-different-type/82987 "2017-04-20T06:43:57Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tim\_wong](https://avatars.discourse-cdn.com/v4/letter/t/4491bb/32.png) [@tim\_wong](https://discuss.elastic.co/u/tim_wong)\
**Post date:** [April 20, 2017, 6:43am UTC](https://discuss.elastic.co/t/mapper-parsing-exception-when-creating-the-same-document-with-different-type/82987/1 "2017-04-20T06:43:57Z")

</div>

I am importing a document twice into the same index but different types. However, I got a [mapper\_parsing\_exception] when I import the document the second time.

Below are my steps.

1. Create the template for the index.

2. Import the document into type `a`. The import was successful.

3. Import the same document into type `b` of the same index. The following exception was thrown:

Below is the mapping of the `stats-demo` after the first successful import:

```auto
{
  "stats-demo": {
    "aliases": {},
    "mappings": {
      "_default_": {
        "include_in_all": false,
        "_all": {
          "enabled": true,
          "norms": false
        },
        "dynamic_templates": [
          {
            "metrics_fields": {
              "path_match": "metrics.*",
              "mapping": {
                "scaling_factor": 100,
                "type": "scaled_float"
              }
            }
          }
        ],
        "properties": {
          "@timestamp": {
            "type": "date"
          },
          "@version": {
            "type": "keyword"
          }
        }
      },
      "a": {
        "include_in_all": false,
        "_all": {
          "enabled": true,
          "norms": false
        },
        "dynamic_templates": [
          {
            "metrics_fields": {
              "path_match": "metrics.*",
              "mapping": {
                "scaling_factor": 100,
                "type": "scaled_float"
              }
            }
          }
        ],
        "properties": {
          "@timestamp": {
            "type": "date"
          },
          "@version": {
            "type": "keyword"
          },
          "metrics": {
            "properties": {
              "blockin": {
                "type": "scaled_float",
                "scaling_factor": 100
              },
              "blockout": {
                "type": "scaled_float",
                "scaling_factor": 100
              },
              "cpu": {
                "type": "scaled_float",
                "scaling_factor": 100
              },
              "memlimit": {
                "type": "scaled_float",
                "scaling_factor": 100
              },
              "memory": {
                "type": "scaled_float",
                "scaling_factor": 100
              },
              "netin": {
                "type": "scaled_float",
                "scaling_factor": 100
              },
              "netout": {
                "type": "scaled_float",
                "scaling_factor": 100
              }
            }
          }
        }
      }
    },
    "settings": {
      "index": {
        "refresh_interval": "5s",
        "number_of_shards": "1",
        "provided_name": "stats-demo",
        "creation_date": "1492669920734",
        "number_of_replicas": "1",
        "uuid": "_kbN2j5sTBieLc08Zcg6vA",
        "version": {
          "created": "5020299"
        }
      }
    }
  }
}

```

I am confusing why the same document couldn't be imported into another `type` of the same index.

Thank you for any help. Any possible solution is appreciated!

---

<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:** [April 20, 2017, 7:46am UTC](https://discuss.elastic.co/t/mapper-parsing-exception-when-creating-the-same-document-with-different-type/82987/2 "2017-04-20T07:46:22Z")

</div>

You cannot do this as it's a collision. You will need to put it in a new index or think of a different structure.

---

<div class="post-metadata">

**Author:** ![tim\_wong](https://avatars.discourse-cdn.com/v4/letter/t/4491bb/32.png) [@tim\_wong](https://discuss.elastic.co/u/tim_wong)\
**Post date:** [April 20, 2017, 7:58am UTC](https://discuss.elastic.co/t/mapper-parsing-exception-when-creating-the-same-document-with-different-type/82987/3 "2017-04-20T07:58:48Z")

</div>

May I know how the collision happens? I thought that `type` is designed to store data with very similar data structure. I can actually import the same document twice if I am using the same type.

Thanks a lot!

---

<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:** [April 20, 2017, 8:01am UTC](https://discuss.elastic.co/t/mapper-parsing-exception-when-creating-the-same-document-with-different-type/82987/4 "2017-04-20T08:01:48Z")

</div>

Sorry, I don't know what I was thinking when I replied previously, but what I said is wrong!

---

<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:** [May 18, 2017, 8:07am UTC](https://discuss.elastic.co/t/mapper-parsing-exception-when-creating-the-same-document-with-different-type/82987/5 "2017-05-18T08:07:34Z")

</div>

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