ElasticSearch设置索引全局默认分片

设置全局分片数量:
put http://196.168.137.100:9200/_template/template_http_request_record
{
“index_patterns”: ["*"],
“settings”: {
“number_of_shards”: 5,
“number_of_replicas”: 1
}
}
指定创建索引时的分片数量:
put http://196.168.137.100:9200/<索引名称>
{
“settings”: {
“number_of_shards”: 5,
“number_of_replicas”: 1
}
}

linux 命令执行
curl -XPUT 'http://xxxxx:9200/_template/template_http_request_record'
   -H 'Content-Type: application/json' -d
  '{"index_patterns": ["*"],"settings": {"number_of_shards": 1,"number_of_replicas": 0}}'
具体json 
执行的接口

_template/template_http_request_record

参数

{
  "index_patterns": ["*"],  #这个是作用于索引匹配
  "settings": {  #配置信息
     "number_of_shards": 1,
     "number_of_replicas": 0 # 备份数量
  }
}

posted @ 2021-04-23 16:31  技术颜良  阅读(863)  评论(0编辑  收藏  举报