# Not able to set index.mapping.single\_type: true on an index

**URL:** <https://discuss.elastic.co/t/not-able-to-set-index-mapping-single-type-true-on-an-index/225967>\
**Category:** Elasticsearch\
**Created:** [April 1, 2020, 2:59am UTC](https://discuss.elastic.co/t/not-able-to-set-index-mapping-single-type-true-on-an-index/225967 "2020-04-01T02:59:10Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![nages](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nages/32/46943_2.png) [@nages](https://discuss.elastic.co/u/nages)\
**Post date:** [April 1, 2020, 2:59am UTC](https://discuss.elastic.co/t/not-able-to-set-index-mapping-single-type-true-on-an-index/225967/1 "2020-04-01T02:59:10Z")

</div>

I had an index that had single type. Now, I am planning to enable "index.mapping.single\_type" and I triggered the following API to make it happen, got the following error.

BTW, I closed the index before applying the above API.

Is there a problem with the syntax or is it not allowed .

> PUT testindex1/\_settings  
> {  
> "settings": {  
> "index.mapping.single\_type": true  
> }  
> }
> 
> {  
> "error": {  
> "root\_cause": [  
> {  
> "type": "illegal\_argument\_exception",  
> "reason": "final testindex1 setting [index.mapping.single\_type], not updateable"  
> }  
> ],  
> "type": "illegal\_argument\_exception",  
> "reason": "final testindex1 setting [index.mapping.single\_type], not updateable"  
> },  
> "status": 400  
> }

---

<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:** [April 1, 2020, 6:44am UTC](https://discuss.elastic.co/t/not-able-to-set-index-mapping-single-type-true-on-an-index/225967/2 "2020-04-01T06:44:12Z")

</div>

It can not work on existing indices.

---

<div class="post-metadata">

**Author:** ![nages](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nages/32/46943_2.png) [@nages](https://discuss.elastic.co/u/nages)\
**Post date:** [April 1, 2020, 7:24am UTC](https://discuss.elastic.co/t/not-able-to-set-index-mapping-single-type-true-on-an-index/225967/3 "2020-04-01T07:24:45Z")

</div>

Interesting . How can i enable this in 5.x in that case, as i understand it is index level setting ?

---

<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:** [April 1, 2020, 8:16am UTC](https://discuss.elastic.co/t/not-able-to-set-index-mapping-single-type-true-on-an-index/225967/4 "2020-04-01T08:16:30Z")

</div>

It can be applied to new indices only I guess?  
But are you sure you need this setting?

I mean that it's there only to make sure you can't create multiple types in one index.

---

<div class="post-metadata">

**Author:** ![nages](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nages/32/46943_2.png) [@nages](https://discuss.elastic.co/u/nages)\
**Post date:** [April 1, 2020, 8:45am UTC](https://discuss.elastic.co/t/not-able-to-set-index-mapping-single-type-true-on-an-index/225967/5 "2020-04-01T08:45:53Z")

</div>

hmm.i tried with new index as you see above, it is even failing as part of index creation. It doesn't seem it works in any way irrespective of whether index is the new or old [in 5.6]  
my intention is to create an index with only one type and I wanted to enforce this in 5.6

I happened to see in the documentation - but it dint help

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

> Elasticsearch 5.6.0
> 
> - Setting `index.mapping.single_type: true` on an index will enable the single-type-per-index behaviour which will be enforced in 6.0.

---

<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:** [April 1, 2020, 9:21am UTC](https://discuss.elastic.co/t/not-able-to-set-index-mapping-single-type-true-on-an-index/225967/6 "2020-04-01T09:21:42Z")

</div>

Can you share exactly the command?

---

<div class="post-metadata">

**Author:** ![nages](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nages/32/46943_2.png) [@nages](https://discuss.elastic.co/u/nages)\
**Post date:** [April 1, 2020, 9:24am UTC](https://discuss.elastic.co/t/not-able-to-set-index-mapping-single-type-true-on-an-index/225967/7 "2020-04-01T09:24:45Z")

</div>

delete testindex1  
PUT testindex1/\_settings  
{  
"settings": {  
"index.mapping.single\_type": true  
}  
}

---

<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:** [April 1, 2020, 9:27am UTC](https://discuss.elastic.co/t/not-able-to-set-index-mapping-single-type-true-on-an-index/225967/8 "2020-04-01T09:27:18Z")

</div>

What about:

```auto
DELETE testindex1
PUT testindex1
{
  "settings": {
    "index.mapping.single_type": true
  }
}

```

---

<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 29, 2020, 9:27am UTC](https://discuss.elastic.co/t/not-able-to-set-index-mapping-single-type-true-on-an-index/225967/9 "2020-04-29T09:27:37Z")

</div>

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