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
}
Some settings are not updatable dynamically even when the index is closed, index.number_of_shards
is also one such setting and they are called final
settings and your index.mapping.single_type
is also final
setting, which is mentioned even in your error message, I bolded the final
part of setting to distinguish it.
final testindex1 setting [index.mapping.single_type], not updateable
you can better understand it using the Elasticsearch source code. class org.elasticsearch.common.settings.Setting
defines the type of settings and see the below explanation for final
settings.
/** * mark this setting as final, not updateable even when the context is not dynamic * ie. Setting this property on an index scoped setting will fail update when the index is closed */ Final,
You can check this line for the above code in Elasticsearch, which explains more and the below code shows this final
type is used to create number of primary shard
settings.
Setting.intSetting(SETTING_NUMBER_OF_SHARDS, 1, 1, maxNumShards, Property.IndexScope, Property.Final);
I hope you understand, now the reason for the error and it looks like you have to re-index the data which new setting.