使用Elasticsearch新发布的Marvel,我想问一个问题,我们是否可以在创建索引时会调整其创建的副本量,这是每次创建索引时。目前,它创建了一个主要和一个复制碎片。可以永久调整吗?
谢谢
replicas
更新curl -XPUT localhost:9200/_template/marvel_custom -d '
{
"order" : 1,
"template" : ".marvel*",
"settings" : {
"number_of_replicas" : 0
}
}'
alasticsearch marvel默认情况下索引将数据与日常索引相似,与Logstash的作用类似。它首先提交一个索引模板,其中包含其索引的默认设置和映射,如下所述。您可以看到默认索引模板只需通过ID检索:
curl -XGET localhost:9200/_template/marvel
,您绝对可以通过提交具有相同名称的更新版本来更改它,但请确保您不要更改默认映射或其他任何内容。
实际上,我建议添加一个额外的索引模板,而不是更改订单高于0的额外索引模板,该订单仅适用您的自定义设置:
curl -XPUT localhost:9200/_template/marvel_custom -d '
{
"order" : 1,
"template" : ".marvel*",
"settings" : {
"number_of_shards" : 5
}
}
'
以这种方式,两个模板都将被应用,并且具有最高顺序的模板将在具有相同名称的设置时获胜。
不应该包括index.number_of_replicas 0吗?看来,如果未指定它,则将退回到默认值
的默认值curl -XPUT localhost:9200/_template/marvel_custom
{
"order" : 1,
"template" : ".marvel*",
"settings" : {
"number_of_shards" : "5",
"index.number_of_replicas" : "0"
}
}