# Rejecting mapping update to \[xxx\] as the final mapping would have more than 1 type: \[\_doc, xxx\]

**URL:** https://discuss.elastic.co/t/rejecting-mapping-update-to-xxx-as-the-final-mapping-would-have-more-than-1-type-doc-xxx/298839
**Category:** Elasticsearch
**Created:** [March 4, 2022, 11:14am UTC](https://discuss.elastic.co/t/rejecting-mapping-update-to-xxx-as-the-final-mapping-would-have-more-than-1-type-doc-xxx/298839 "2022-03-04T11:14:05Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![Ramesh\_balasubramani](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ramesh_balasubramani/32/53173_2.png) [@Ramesh\_balasubramani](https://discuss.elastic.co/u/Ramesh_balasubramani)
#### Post date: [March 4, 2022, 11:14am UTC](https://discuss.elastic.co/t/rejecting-mapping-update-to-xxx-as-the-final-mapping-would-have-more-than-1-type-doc-xxx/298839/1 "2022-03-04T11:14:05Z")

</div>

I am using Elasticsearch 7.10.2 version.  
I need to create one index,

- Index name = device
- \_type name = device

But I am not able to create getting error.

```auto
POST device/device/169062
{
               "device_name": "DESK-0002",
               "device_ip": "1.1.1.1",
               "device_os": "Default",
               "device_status": "Online"
}

```

Getting below error :-

```auto
{
   "error": {
      "root_cause": [
         {
            "type": "illegal_argument_exception",
            "reason": "Rejecting mapping update to [device] as the final mapping would have more than 1 type: [_doc, device]"
         }
      ],
      "type": "illegal_argument_exception",
      "reason": "Rejecting mapping update to [device] as the final mapping would have more than 1 type: [_doc, device]"
   },
   "status": 400
}

```

I tried reindex also,

```auto
POST _reindex
{
  "source": {
    "index": "device",
    "type" : "_doc"
  },
  "dest": {
    "index": "device1",
    "type" : "device"
  }
}

```

Getting below error :

```auto
   "failures": [
      {
         "index": "device1",
         "type": "device",
         "id": "169062",
         "cause": {
            "type": "illegal_argument_exception",
            "reason": "Rejecting mapping update to [device1] as the final mapping would have more than 1 type: [_doc, device]"
         },
         "status": 400
      }
   ]

```

---

<div class="post-metadata">

### Author: ![Ramesh\_balasubramani](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ramesh_balasubramani/32/53173_2.png) [@Ramesh\_balasubramani](https://discuss.elastic.co/u/Ramesh_balasubramani)
#### Post date: [March 4, 2022, 11:49am UTC](https://discuss.elastic.co/t/rejecting-mapping-update-to-xxx-as-the-final-mapping-would-have-more-than-1-type-doc-xxx/298839/2 "2022-03-04T11:49:24Z")

</div>

Please anyone help me out of this issue.

---

<div class="post-metadata">

### Author: ![casterQ](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/casterq/32/93257_2.png) [@casterQ](https://discuss.elastic.co/u/casterQ)
#### Post date: [March 4, 2022, 11:59am UTC](https://discuss.elastic.co/t/rejecting-mapping-update-to-xxx-as-the-final-mapping-would-have-more-than-1-type-doc-xxx/298839/3 "2022-03-04T11:59:36Z")

</div>

in ES 7.10 ，`_type` doesn't work，you‘d better ensure each index has only one type called `_doc`

---

<div class="post-metadata">

### Author: ![casterQ](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/casterq/32/93257_2.png) [@casterQ](https://discuss.elastic.co/u/casterQ)
#### Post date: [March 4, 2022, 12:00pm UTC](https://discuss.elastic.co/t/rejecting-mapping-update-to-xxx-as-the-final-mapping-would-have-more-than-1-type-doc-xxx/298839/4 "2022-03-04T12:00:30Z")

</div>

here is the doc:

> **[Removal of mapping types | Elasticsearch Guide \[7.10\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/removal-of-types.html)**

---

<div class="post-metadata">

### Author: ![Ramesh\_balasubramani](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ramesh_balasubramani/32/53173_2.png) [@Ramesh\_balasubramani](https://discuss.elastic.co/u/Ramesh_balasubramani)
#### Post date: [March 4, 2022, 12:09pm UTC](https://discuss.elastic.co/t/rejecting-mapping-update-to-xxx-as-the-final-mapping-would-have-more-than-1-type-doc-xxx/298839/5 "2022-03-04T12:09:08Z")

</div>

Thanks for the reply. But in my local machine I am able to create different index  
type. Same ES version 7.10.2v

Please find below

```auto
{
  "name" : "LPTP-565",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "GZqTHy8uReu1egwqwV0etg",
  "version" : {
    "number" : "7.10.2",
    "build_flavor" : "default",
    "build_type" : "zip",
    "build_hash" : "747e1cc71def077253878a59143c1f785afa92b9",
    "build_date" : "2021-01-13T00:42:12.435326Z",
    "build_snapshot" : false,
    "lucene_version" : "8.7.0",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

```

```auto
{
            "_index": "device",
            "_type": "device",
            "_id": "169062",
            "_score": 1,
            "_source": {
               "device_name": "DESK-0002",
               "device_ip": "10.1.1.1",
               "device_os": "Default",
               "device_status": "Online"
            }
         }

```

---

<div class="post-metadata">

### Author: ![casterQ](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/casterq/32/93257_2.png) [@casterQ](https://discuss.elastic.co/u/casterQ)
#### Post date: [March 4, 2022, 2:03pm UTC](https://discuss.elastic.co/t/rejecting-mapping-update-to-xxx-as-the-final-mapping-would-have-more-than-1-type-doc-xxx/298839/6 "2022-03-04T14:03:25Z")

</div>

yes，v7.10 your can do it，but each index only can have one type， int v8+ ，it will not work

---

<div class="post-metadata">

### Author: ![Ramesh\_balasubramani](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ramesh_balasubramani/32/53173_2.png) [@Ramesh\_balasubramani](https://discuss.elastic.co/u/Ramesh_balasubramani)
#### Post date: [March 4, 2022, 6:52pm UTC](https://discuss.elastic.co/t/rejecting-mapping-update-to-xxx-as-the-final-mapping-would-have-more-than-1-type-doc-xxx/298839/7 "2022-03-04T18:52:52Z")

</div>

In my above example, I am adding only one type. But getting below error, I don't want \_doc type instead of need device.

```auto
"type": "illegal_argument_exception",
      "reason": "Rejecting mapping update to [device] as the final mapping would have more than 1 type: [_doc, device]"
   

```

---

<div class="post-metadata">

### Author: ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)
#### Post date: [March 4, 2022, 9:30pm UTC](https://discuss.elastic.co/t/rejecting-mapping-update-to-xxx-as-the-final-mapping-would-have-more-than-1-type-doc-xxx/298839/8 "2022-03-04T21:30:05Z")

</div>

This error means that the index `device` already exists and was created as having the `_doc` type, which is the default in version 7.X.

In version 7.X you still can create index with custom types, but you should move away from using types on index as this does not work anymore in version 8.X.

Try to create a different index and you will see that this still works.

```auto
POST new-index-name/device/169062
{
               "device_name": "DESK-0002",
               "device_ip": "1.1.1.1",
               "device_os": "Default",
               "device_status": "Online"
}

```

But since your `device` index already exists, you won't be able to add a document with a different type from `_doc`.

Can you run `GET device/_search` in Kibana Dev Tools and share the result?

---

<div class="post-metadata">

### Author: ![Ramesh\_balasubramani](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ramesh_balasubramani/32/53173_2.png) [@Ramesh\_balasubramani](https://discuss.elastic.co/u/Ramesh_balasubramani)
#### Post date: [March 5, 2022, 3:58am UTC](https://discuss.elastic.co/t/rejecting-mapping-update-to-xxx-as-the-final-mapping-would-have-more-than-1-type-doc-xxx/298839/9 "2022-03-05T03:58:21Z")

</div>

```auto
POST new-index-name/device/169062
{
               "device_name": "DESK-0002",
               "device_ip": "1.1.1.1",
               "device_os": "Default",
               "device_status": "Online"
}

```

Result :-

```auto
{
   "error": {
      "root_cause": [
         {
            "type": "illegal_argument_exception",
            "reason": "Rejecting mapping update to [new-index-name] as the final mapping would have more than 1 type: [_doc, device]"
         }
      ],
      "type": "illegal_argument_exception",
      "reason": "Rejecting mapping update to [new-index-name] as the final mapping would have more than 1 type: [_doc, device]"
   },
   "status": 400
}

```

`GET device/_search`

Result :-

```auto
{
   "error": {
      "root_cause": [
         {
            "type": "index_not_found_exception",
            "reason": "no such index [device]",
            "resource.type": "index_or_alias",
            "resource.id": "device",
            "index_uuid": "_na_",
            "index": "device"
         }
      ],
      "type": "index_not_found_exception",
      "reason": "no such index [device]",
      "resource.type": "index_or_alias",
      "resource.id": "device",
      "index_uuid": "_na_",
      "index": "device"
   },
   "status": 404
}

```

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [March 5, 2022, 4:13am UTC](https://discuss.elastic.co/t/rejecting-mapping-update-to-xxx-as-the-final-mapping-would-have-more-than-1-type-doc-xxx/298839/10 "2022-03-05T04:13:52Z")

</div>

Try instead with

```
POST new-index-name/_doc/169062
```

---

<div class="post-metadata">

### Author: ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)
#### Post date: [March 5, 2022, 5:33am UTC](https://discuss.elastic.co/t/rejecting-mapping-update-to-xxx-as-the-final-mapping-would-have-more-than-1-type-doc-xxx/298839/11 "2022-03-05T05:33:56Z")

</div>

Do you have any index template that is being applied to the `device` index or the other indice name that you tried?

I was only able to replicate this if I have an index template created without specifying the type in the template and without using `include_type_name=true` when creating the template.

**Without a template** :

`REQUEST`

```auto
POST device/device/169062
{
    "device_name": "DESK-0002",
    "device_ip": "1.1.1.1",
    "device_os": "Default",
    "device_status": "Online"
}

```

`RESPONSE`

```auto
#! Deprecation: [types removal] Specifying types in document index requests is deprecated, use the typeless endpoints instead (/{index}/_doc/{id}, /{index}/_doc, or /{index}/_create/{id}).
{
  "_index" : "device",
  "_type" : "device",
  "_id" : "169062",
  "_version" : 1,
  "result" : "created",
  "_shards" : {
    "total" : 2,
    "successful" : 1,
    "failed" : 0
  },
  "_seq_no" : 0,
  "_primary_term" : 1
}

```

**WIth a template without specifying the type** :

Same request as above.

`RESPONSE`

```auto
{
  "error" : {
    "root_cause" : [
      {
        "type" : "illegal_argument_exception",
        "reason" : "Rejecting mapping update to [device] as the final mapping would have more than 1 type: [_doc, device]"
      }
    ],
    "type" : "illegal_argument_exception",
    "reason" : "Rejecting mapping update to [device] as the final mapping would have more than 1 type: [_doc, device]"
  },
  "status" : 400
}

```

But even with this error, the indice is created, just without the document.

So `GET device/_search` returns:

```auto
{
  "took" : 1,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 0,
      "relation" : "eq"
    },
    "max_score" : null,
    "hits" : []
  }
}

```

It's strange that it shows index not found for you.

Anyway, the best solution is to **not use types** as this is deprecated and was removed in version 8.

If you still want to keep using types you need to check if you have any templates being applied to the `device` index, and if you have you need to recreate the templates with the type.

---

<div class="post-metadata">

### Author: ![Ramesh\_balasubramani](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ramesh_balasubramani/32/53173_2.png) [@Ramesh\_balasubramani](https://discuss.elastic.co/u/Ramesh_balasubramani)
#### Post date: [March 5, 2022, 6:57pm UTC](https://discuss.elastic.co/t/rejecting-mapping-update-to-xxx-as-the-final-mapping-would-have-more-than-1-type-doc-xxx/298839/13 "2022-03-05T18:57:31Z")

</div>

Thank you so much. Problem in Index Template.

---

<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: [April 2, 2022, 6:57pm UTC](https://discuss.elastic.co/t/rejecting-mapping-update-to-xxx-as-the-final-mapping-would-have-more-than-1-type-doc-xxx/298839/14 "2022-04-02T18:57:45Z")

</div>

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