---
type: api
title: Update Watcher index settings
description: Update settings for the Watcher internal index (`.watches`).
url: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/elasticsearch/v9/operation/operation-watcher-update-settings
resource: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/elasticsearch/v9/operation/operation-watcher-update-settings
products:
  - Elasticsearch
---

# Update Watcher index settings

## Paths

- `PUT` `/_watcher/settings`

## Description

Update settings for the Watcher internal index (`.watches`).
Only a subset of settings can be modified.
This includes `index.auto_expand_replicas`, `index.number_of_replicas`, `index.routing.allocation.exclude.*`,
`index.routing.allocation.include.*` and `index.routing.allocation.require.*`.
Modification of `index.routing.allocation.include._tier_preference` is an exception and is not allowed as the
Watcher shards must always be in the `data_content` tier.

## Required authorization

- Cluster privileges: `manage_watcher`

## Authentication

- Api key: `Authorization: <value>`
  Elasticsearch APIs support key-based authentication.
  You must create an API key and use the encoded value in the request header.
  For example:
  
  
  ```
  curl -X GET "${ES_URL}/_cat/indices?v=true" \
    -H "Authorization: ApiKey ${API_KEY}"
  ```
  
  To get API keys, use the `/_security/api_key` APIs.
- Basic: `Authorization: Basic <credentials>`
- Bearer: `Authorization: Bearer <token>`
  Elasticsearch APIs support the use of bearer tokens in the `Authorization` HTTP header to authenticate with the API.
  For examples, refer to [Token-based authentication services](https://www.elastic.co/docs/deploy-manage/users-roles/cluster-or-deployment-auth/token-based-authentication-services)

## Query string parameters

- `master_timeout` (string · default: 30s) — optional
  The period to wait for a connection to the master node.
If no response is received before the timeout expires, the request fails and returns an error.
- `timeout` (string) — optional
  The period to wait for a response.
If no response is received before the timeout expires, the request fails and returns an error.

## Request body

`application/json`

- `index.auto_expand_replicas` (string) — optional
- `index.number_of_replicas` (number) — optional

## Response

`application/json`

- `acknowledged` (boolean)
## Code examples

#### Console

```console
PUT /_watcher/settings
{
  "index.auto_expand_replicas": "0-4"
}
```

#### JavaScript

```javascript
const response = await client.watcher.updateSettings({
  "index.auto_expand_replicas": "0-4",
});
```

#### Python

```python
resp = client.watcher.update_settings(
    index_auto_expand_replicas="0-4",
)
```

#### curl

```curl
curl -X PUT "$ELASTICSEARCH_URL/_watcher/settings" \
  -H "Authorization: ApiKey $ELASTIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "index.auto_expand_replicas": "0-4"
  }'
```

#### Java

```java
client.watcher().updateSettings(u -> u
    .indexAutoExpandReplicas("0-4")
);
```

#### PHP

```php
$resp = $client->watcher()->updateSettings([
    "body" => [
        "index.auto_expand_replicas" => "0-4",
    ],
]);
```

#### Ruby

```ruby
response = client.watcher.update_settings(
  body: {
    "index.auto_expand_replicas": "0-4"
  }
)
```

