Update index settings APIedit

Changes a dynamic index setting in real time.

For data streams, index setting changes are applied to all backing indices by default.

PUT /my-index-000001/_settings
  "index" : {
    "number_of_replicas" : 2


PUT /<target>/_settings


  • If the Elasticsearch security features are enabled, you must have the manage index privilege for the target data stream, index, or index alias.

Path parametersedit


(Optional, string) Comma-separated list of data streams, indices, and index aliases used to limit the request. Wildcard expressions (*) are supported.

To target all data streams and indices in a cluster, omit this parameter or use _all or *.

Query parametersedit


(Optional, Boolean) If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar.

Defaults to false.


(Optional, string) Type of index that wildcard expressions can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as open,hidden. Valid values are:

Match any data stream or index, including hidden ones.
Match open, non-hidden indices. Also matches any non-hidden data stream.
Match closed, non-hidden indices. Also matches any non-hidden data stream. Data streams cannot be closed.
Match hidden data streams and hidden indices. Must be combined with open, closed, or both.
Wildcard expressions are not accepted.

Defaults to open.

(Optional, Boolean) If true, returns settings in flat format. Defaults to false.
(Optional, Boolean) If true, missing or closed indices are not included in the response. Defaults to false.
(Optional, Boolean) If true, existing index settings remain unchanged. Defaults to false.
(Optional, time units) 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. Defaults to 30s.
(Optional, time units) Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. Defaults to 30s.

Request bodyedit

(Optional, index setting object) Configuration options for the index. See Index Settings.


Reset an index settingedit

To revert a setting to the default value, use null. For example:

PUT /my-index-000001/_settings
  "index" : {
    "refresh_interval" : null

The list of per-index settings which can be updated dynamically on live indices can be found in Index modules. To preserve existing settings from being updated, the preserve_existing request parameter can be set to true.

Bulk indexing usageedit

For example, the update settings API can be used to dynamically change the index from being more performant for bulk indexing, and then move it to more real time indexing state. Before the bulk indexing is started, use:

PUT /my-index-000001/_settings
  "index" : {
    "refresh_interval" : "-1"

(Another optimization option is to start the index without any replicas, and only later adding them, but that really depends on the use case).

Then, once bulk indexing is done, the settings can be updated (back to the defaults for example):

PUT /my-index-000001/_settings
  "index" : {
    "refresh_interval" : "1s"

And, a force merge should be called:

POST /my-index-000001/_forcemerge?max_num_segments=5

Update index analysisedit

You can only define new analyzers on closed indices.

To add an analyzer, you must close the index, define the analyzer, and reopen the index.

You cannot close the write index of a data stream.

To update the analyzer for a data stream’s write index and future backing indices, update the analyzer in the index template used by the stream. Then roll over the data stream to apply the new analyzer to the stream’s write index and future backing indices. This affects searches and any new data added to the stream after the rollover. However, it does not affect the data stream’s backing indices or their existing data.

To change the analyzer for existing backing indices, you must create a new data stream and reindex your data into it. See Use reindex to change mappings or settings.

For example, the following commands add the content analyzer to the my-index-000001 index:

POST /my-index-000001/_close

PUT /my-index-000001/_settings
  "analysis" : {

POST /my-index-000001/_open