---
type: api
title: Update the cluster settings
description: Configure and update dynamic settings on a running cluster.
url: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch/operation/operation-cluster-put-settings
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch/operation/operation-cluster-put-settings
products:
  - Elasticsearch
---

# Update the cluster settings

Availability:

## Paths

- `PUT` `/_cluster/settings`

- [Api key auth](/elastic/docs-builder/docs/4371/api/doc/elasticsearch/authentication#apikeyauth)
- [Basic auth](/elastic/docs-builder/docs/4371/api/doc/elasticsearch/authentication#basicauth)
- [Bearer auth](/elastic/docs-builder/docs/4371/api/doc/elasticsearch/authentication#bearerauth)

## Description

Configure and update dynamic settings on a running cluster.
You can also configure dynamic settings locally on an unstarted or shut down node in `elasticsearch.yml`.

Updates made with this API can be persistent, which apply across cluster restarts, or transient, which reset after a cluster restart.
You can also reset transient or persistent settings by assigning them a null value.

If you configure the same setting using multiple methods, Elasticsearch applies the settings in following order of precedence: 1) Transient setting; 2) Persistent setting; 3) `elasticsearch.yml` setting; 4) Default setting value.
For example, you can apply a transient setting to override a persistent setting or `elasticsearch.yml` setting.
However, a change to an `elasticsearch.yml` setting will not override a defined transient or persistent setting.

TIP: In Elastic Cloud, use the user settings feature to configure all cluster settings. This method automatically rejects unsafe settings that could break your cluster.
If you run Elasticsearch on your own hardware, use this API to configure dynamic cluster settings.
Only use `elasticsearch.yml` for static cluster settings and node settings.
The API doesn’t require a restart and ensures a setting’s value is the same on all nodes.

WARNING: Transient cluster settings are no longer recommended. Use persistent cluster settings instead.
If a cluster becomes unstable, transient settings can clear unexpectedly, resulting in a potentially undesired cluster configuration.

[More about Elastic Stack settings](https://www.elastic.co/docs/deploy-manage/stack-settings)

## Query String Parameters

- `flat_settings` (boolean · default: false)
  Return settings in flat format
- `master_timeout` (string Duration · default: 30s)
  The period to wait for a connection to the master node.
- `timeout` (string Duration · default: 30s)
  The period to wait for a response.

## Request Body

`application/json`

- `persistent` (map string to object) — optional
  The settings that persist after the cluster restarts.
- `transient` (map string to object) — optional
  The settings that do not persist after the cluster restarts.

## Response

`application/json`

- `acknowledged` (boolean)
- `persistent` (map string to object)
- `transient` (map string to object)
## Code Examples

#### Console

```console
PUT /_cluster/settings
{
  "persistent" : {
    "indices.recovery.max_bytes_per_sec" : "50mb"
  }
}
```

#### JavaScript

```javascript
const response = await client.cluster.putSettings({
  persistent: {
    "indices.recovery.max_bytes_per_sec": "50mb",
  },
});
```

#### Python

```python
resp = client.cluster.put_settings(
    persistent={
        "indices.recovery.max_bytes_per_sec": "50mb"
    },
)
```

#### curl

```curl
curl -X PUT "$ELASTICSEARCH_URL/_cluster/settings" \
  -H "Authorization: ApiKey $ELASTIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "persistent": {
      "indices.recovery.max_bytes_per_sec": "50mb"
    }
  }'
```

#### Java

```java
client.cluster().putSettings(p -> p
    .persistent("indices.recovery.max_bytes_per_sec", JsonData.fromJson("\"50mb\""))
);
```

#### C#

```c#
var response = await client.Cluster
    .PutSettingsAsync(d1 => d1
        .Persistent(new Dictionary<string, object>()
        {
            { "indices.recovery.max_bytes_per_sec", "50mb" }
        })
    );
```

#### PHP

```php
$resp = $client->cluster()->putSettings([
    "body" => [
        "persistent" => [
            "indices.recovery.max_bytes_per_sec" => "50mb",
        ],
    ],
]);
```

#### Ruby

```ruby
response = client.cluster.put_settings(
  body: {
    "persistent": {
      "indices.recovery.max_bytes_per_sec": "50mb"
    }
  }
)
```

