首页 > 解决方案 > elasticsearch total_fields.limit 作为全局

问题描述

我有大型文档(每个文档中有超过 1000 个字段)所以我需要为我的每个索引设置 index.mapping.total_fields.limit = 9000,

我可以为所有索引设置全局配置并更改它们的默认限制吗?我使用 elasticsearch js 库,(但我也可以使用 API)

谢谢,拉里

标签: elasticsearch

解决方案


您可以做的是使用一个索引模板,该模板将在创建时应用于所有索引:

PUT _template/common-template
{
  "index_patterns": "*",                    <--- applies to all indices
  "order": 10,                              <--- high order to apply the template last
  "settings": {
    "index": {
      "mapping": {
        "total_fields": {
          "limit": "9000"                   <--- this setting will apply to all indices
        }
      }
    }
  },
  "aliases": {},
  "mappings": {
     ... common mappings go here...
  }
}

推荐阅读