对于没有模板创建的所有新索引,我需要将 index.number_of_replicas 设置为 0。
这不能再通过elasticsearch.yml 来完成。建议的方法是使用模板,但是我正在寻找一种不使用模板的方法。
如有任何帮助,我们将不胜感激,谢谢:)
我知道的唯一方法是使用索引模板。
请注意,可以有任意多个索引模板,而不仅仅是每个索引一个。您可以使用以下设置来控制它们的顺序(即它们如何相互覆盖)order
:
# This template is low priority and applies to all indexes:
PUT _template/template_1
{
"index_patterns": ["*"], <-- applies to all indexes
"order": 0, <-- lowest priority
"settings": {
"number_of_shards": 1,
"number_of_replicas": 0
}
}
# This template has a higher priority and only applies to indexes foo*:
PUT _template/template_1
{
"index_patterns": ["foo*"], <-- only applies to foo*
"order": 3, <-- higher priority
"settings": {
"number_of_shards": 1,
"number_of_replicas": 1 <-- overrides the number of replicas from base template
}
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
12484 次 |
最近记录: |