If you need to apply a setting dynamically after the cluster has already started, and it can actually be set dynamically, then you can set it using _cluster/settings
API.
Persistent settings are one of the two type of cluster-wide settings that can be applied. A persistent setting will survive a full cluster restart.
Note: Not all settings can be applied dynamically. For example, the cluster's name cannot be renamed dynamically. Most node-level settings cannot be set dynamically either (because they cannot be targeted individually).
This is not the API to use to set index-level settings. You can tell that setting is an index level setting because it should start with index.
. Settings whose name are in the form of indices.
are cluster-wide settings because they apply to all indices.
POST /_cluster/settings
{
"persistent": {
"cluster.routing.allocation.enable": "none"
}
}
Warning: In Elasticsearch 1.x and 2.x, you cannot unset a persistent setting.
Fortunately, this has been improved in Elasticsearch 5.x and you can now remove a setting by setting it to null
:
POST /_cluster/settings
{
"persistent": {
"cluster.routing.allocation.enable": null
}
}
An unset setting will return to its default, or any value defined at a lower priority level (e.g., command line settings).