With the newly released Marvel from ElasticSearch I wanted to ask the question whether we could adjust the amount of replicas it creates upon creating an index, that is every time it creates an index. It currently creates one primary and one replica shard. Can this be adjusted permanently?
Thanks
Update for Replicas
curl -XPUT localhost:9200/_template/marvel_custom -d '
{
"order" : 1,
"template" : ".marvel*",
"settings" : {
"number_of_replicas" : 0
}
}'
Elasticsearch Marvel by default indexes data into daily indices, similarly to what logstash does. It first submits an index template that contains the default settings and mappings for its indices, as mentioned here. You can see the default index template just retrieving it by id:
curl -XGET localhost:9200/_template/marvel
and you can definitely change it by just submitting an updated version of it with same name, but make sure you don't change the default mappings or anything else.
In fact instead of changing the default index template, I'd suggest to add an additional one, with order higher than 0, which applies only your custom settings:
curl -XPUT localhost:9200/_template/marvel_custom -d '
{
"order" : 1,
"template" : ".marvel*",
"settings" : {
"number_of_shards" : 5
}
}
'
This way both templates will get applied, and the one with highest order will win when it comes to settings with same name.
shouldn't new template include index.number_of_replicas 0? It seems that if it is not specified then it will fall back to default which is one
curl -XPUT localhost:9200/_template/marvel_custom
{
"order" : 1,
"template" : ".marvel*",
"settings" : {
"number_of_shards" : "5",
"index.number_of_replicas" : "0"
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With