ES7 中对索引指定副本和分片数

个人学习笔记,谢绝转载!!!

原文:https://www.cnblogs.com/wshenjin/p/15156235.html


1、创建索引时指定

PUT /nginx-logs {
    "settings": {
        "number_of_shards":3,
        "number_of_replicas":1
   }
}

2、通过模板
新建一个template_nginx_logs的模板,匹配nginx-log-开头的索引,并配置副本数和分片数

PUT /_template/template_nginx_logs' { 
    "index_patterns" : ["nginx-log-*"], 
    "settings":{
        "number_of_shards":3,
        "number_of_replicas":1
    }
}
原文地址:https://www.cnblogs.com/wshenjin/p/15156235.html