Not able to set index.mapping.single_type: true on an index

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
}

It can not work on existing indices.

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

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.

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

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.

Can you share exactly the command?

delete testindex1
PUT testindex1/_settings
{
"settings": {
"index.mapping.single_type": true
}
}

What about:

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

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