ES Configurations

Shards

Modify the default number of shards

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
PUT http://localhost:9200/_template/index_defaults 
{
"index_patterns": "*",
"settings": {
"number_of_shards": 3,
"number_of_replicas": 0,
"index.refresh_interval":"15s",
"index.translog": {
"sync_interval": "120s",
"durability": "async",
"flush_threshold_size":"1g"
}
}
}

# curl -XPOST -H "Content-Type:application/json" -d '{"template":"*","settings":{"number_of_shards":1}}' http://elasticsearch-client-service:9200/_template/default
# curl -XPOST -H "Content-Type:application/json" -d '{"template":"*","settings":{"number_of_shards":3,"number_of_replicas":0,"index.refresh_interval":"60s","index.translog":{"sync_interval":"120s","durability":"async","flush_threshold_size":"1g"}}}' http://elasticsearch-client-service:9200/_template/default
# https://www.jianshu.com/p/f0e9ab2a47fe
# https://www.objectrocket.com/blog/elasticsearch/clustered-elasticsearch-best-practices/
# https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html