elasticsearch - 无法设置index.mapping.single_type:对索引为true

标签 elasticsearch indexing elasticsearch-mapping

我有一个单一类型的索引。现在,我计划启用“index.mapping.single_type”,并触发了以下API使其实现,并收到以下错误。

顺便说一句,我在应用上述API之前关闭了索引。

语法是否有问题或不允许使用。

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
}

最佳答案

即使关闭索引,某些设置也无法动态更新,index.number_of_shards也是此类设置之一,它们称为final设置,而您的index.mapping.single_type也是final设置,即使在您的错误消息中也提到了这一点,我将设置的final部分加粗为区分它。

final testindex1 setting [index.mapping.single_type], not updateable



您可以使用Elasticsearch源代码更好地理解它。 org.elasticsearch.common.settings.Setting类定义设置的类型,请参见下面的final设置说明。

/** * 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,



您可以在Elasticsearch中为上面的代码检查this line,这将解释更多,下面的代码显示此final类型用于创建number of primary shard设置。
Setting.intSetting(SETTING_NUMBER_OF_SHARDS, 1, 1, maxNumShards, Property.IndexScope, Property.Final);

希望您理解,现在出现错误的原因和它看起来像您必须重新索引哪个新设置的数据。

关于elasticsearch - 无法设置index.mapping.single_type:对索引为true,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60963402/

相关文章:

python - 如何等待 elasticsearch helpers.reindex 在 Python 中完成?

mysql - 使用 GROUP BY 查询会变慢

c - 根据您的索引从 C 中的链表中删除

elasticsearch - 对象或键值对上的Elasticsearch聚合

node.js - 如何在nodejs中用mongoosastic写Mapping

elasticsearch - 尝试通过Parital更新文档,但是在获取有关epoch_second格式的日期字段时出现错误

elasticsearch - Filebeat的KV处理器

amazon-web-services - AWS ElasticSearch 从远程集群重新索引方案、主机和白名单问题

mongodb - Playframework + Morphia + MongoDb + ElasticSearch = Disater?

PostgreSQL索引使用,备份pg_catalog数据