The update settings API
Elasticsearch lets us tune itself by specifying the various parameters in the elasticsearch.yml
file. But you should treat this file as the set of default values that can be changed in the runtime using the Elasticsearch REST API. We can change both the per index setting and the cluster wide settings. However, you should remember that not all properties can be dynamically changed. If you try to alter these parameters, Elasticsearch will respond with a proper error.
The cluster settings API
In order to set one of the cluster properties, we need to use the HTTP PUT
method and send a proper request to the _cluster/settings
URI. However, we have two options: adding the changes as transient or permanent.
The first one, transient, will set the property only until the first restart. In order to do this, we send the following command:
curl -XPUT 'localhost:9200/_cluster/settings' -d '{ "transient" : { "PROPERTY_NAME" : "PROPERTY_VALUE" } }'
As you can see, in the preceding...