Cluster settings

Introduced 1.0

The cluster settings operation lets you check the current settings for your cluster, review default settings, and change settings. When you update a setting using the API, OpenSearch applies it to all nodes in the cluster.

Path and HTTP methods

  1. GET _cluster/settings
  2. PUT _cluster/settings

Path parameters

All cluster setting parameters are optional.

ParameterData typeDescription
flat_settingsBooleanWhether to return settings in the flat form, which can improve readability, especially for heavily nested settings. For example, the flat form of “cluster”: { “max_shards_per_node”: 500 } is “cluster.max_shards_per_node”: “500”.
include_defaults (GET only)BooleanWhether to include default settings as part of the response. This parameter is useful for identifying the names and current values of settings you want to update.
cluster_manager_timeoutTime unitThe amount of time to wait for a response from the cluster manager node. Default is 30 seconds.
timeout (PUT only)Time unitThe amount of time to wait for a response from the cluster. Default is 30 seconds.

Example request

  1. GET _cluster/settings?include_defaults=true

copy

Example response

  1. PUT _cluster/settings
  2. {
  3. "persistent":{
  4. "action.auto_create_index": false
  5. }
  6. }

Request fields

The GET operation has no request body options. All cluster setting field parameters are optional.

Not all cluster settings can be updated using the cluster settings API. You will receive the error message "setting [cluster.some.setting], not dynamically updateable" when trying to configure these settings via the API.

The following request field parameters are compatible with the cluster API.

FieldData typeDescription
action.auto_create_indexBooleanAutomatically creates an index if the index doesn’t already exist. Also applies any index templates that are configured. Default is true.
action.destructive_requires_nameBooleanWhen set to true, you must specify the index name to delete an index. You cannot delete all indexes or use wildcards. Default is true.
cluster.indices.close.enableBooleanEnables closing of open indexes in OpenSearch. Default is true.
indices.recovery.max_bytes_per_secStringLimits the total inbound and outbound recovery traffic for each node. This applies to peer recoveries and snapshot recoveries. Default is 40mb. If you set the recovery traffic value to less than or equal to 0mb, rate limiting will be disabled, which causes recovery data to be transferred at the highest possible rate.
indices.recovery.max_concurrent_file_chunksIntegerThe number of file chunks sent in parallel for each recovery operation. Default is 2.
indices.recovery.max_concurrent_operationsIntegerThe number of operations sent in parallel for each recovery. Default is 1.
logger.org.opensearch.discoveryStringLoggers accept Log4j2’s built-in log levels: OFF, FATAL, ERROR, WARN, INFO, DEBUG, and TRACE. Default is INFO.
breaker.model_inference.limitStringThe limit for the trained model circuit breaker. Default is 50% of the JVM heap.
breaker.model_inference.overheadIntegerThe constant that all trained model estimations are multiplied by to determine a final estimation. Default is 1.
search.max_bucketsIntegerThe maximum number of aggregation buckets allowed in a single response. Default is 65536.
snapshot.max_concurrent_operationsIntegerThe maximum number of concurrent snapshot operations. Default is 1000.
slm.health.failed_snapshot_warn_thresholdStringThe number of failed invocations since the last successful snapshot that will indicate a problem as per the health API profile. Default is five repeated failures: 5L.
indices.breaker.total.limitStringThe starting limit for the overall parent breaker. Default is 70% of the JVM heap if indices.breaker.total.use_real_memory is set to false. Default is 95% of the JVM heap if indices.breaker.total.use_real_memory is set to true.
indices.breaker.fielddata.limitStringThe limit for the fielddata breaker. Default is 40% of the JVM heap.
indices.breaker.fielddata.overheadFloating pointThe constant that all fielddata estimations are multiplied by to determine a final estimation. Default is 1.03.
indices.breaker.request.limitStringThe limit for the request breaker. Default is 60% of the JVM heap.
indices.breaker.request.overheadIntegerThe constant that all request estimations are multiplied by to determine a final estimation. Default is 1.
network.breaker.inflight_requests.limitStringThe limit for the in-flight requests breaker. Default is 100% of the JVM heap.
network.breaker.inflight_requests.overheadInteger/Time unitThe constant that all in-flight request estimations are multiplied by to determine a final estimation. Default is 2.
script.max_compilations_rateStringThe limit for the number of unique dynamic scripts within a defined interval that are allowed to be compiled. Default is 150 every 5 minutes: 150/5m.
cluster.routing.allocation.enableStringEnables or disables allocation for specific kinds of shards:

all – Allows shard allocation for all types of shards.

primaries – Allows shard allocation for primary shards only.

new_primaries – Allows shard allocation for primary shards for new indexes only.

none – No shard allocations are allowed for any indexes.

Default is all.
cluster.routing.allocation.node_concurrent_incoming_recoveriesIntegerConfigures how many concurrent incoming shard recoveries are allowed to happen on a node. Default is 2.
cluster.routing.allocation.node_concurrent_outgoing_recoveriesIntegerConfigures how many concurrent outgoing shard recoveries are allowed to happen on a node. Default is 2.
cluster.routing.allocation.node_concurrent_recoveriesStringUsed to set cluster.routing.allocation.node_concurrent_incoming_recoveries and cluster.routing.allocation.node_concurrent_outgoing_recoveries to the same value.
cluster.routing.allocation.node_initial_primaries_recoveriesIntegerSets the number of recoveries for unassigned primaries after a node restart. Default is 4.
cluster.routing.allocation.same_shard.hostBooleanWhen set to true, multiple copies of a shard are prevented from being allocated to distinct nodes on the same host. Default is false.
cluster.routing.rebalance.enableStringEnables or disables rebalancing for specific kinds of shards:

all – Allows shard balancing for all types of shards.

primaries – Allows shard balancing for primary shards only.

replicas – Allows shard balancing for replica shards only.

none – No shard balancing is allowed for any indexes.

Default is all.
cluster.routing.allocation.allow_rebalanceStringSpecifies when shard rebalancing is allowed:

always – Always allow rebalancing.

indices_primaries_active – Only allow rebalancing when all primaries in the cluster are allocated.

indices_all_active – Only allow rebalancing when all shards in the cluster are allocated.

Default is indices_all_active.
cluster.routing.allocation.cluster_concurrent_rebalanceIntegerAllows you to control how many concurrent shard rebalances are allowed across a cluster. Default is 2.
cluster.routing.allocation.balance.shardFloating pointDefines the weight factor for the total number of shards allocated per node. Default is 0.45.
cluster.routing.allocation.balance.indexFloating pointDefines the weight factor for the number of shards per index allocated on a node. Default is 0.55.
cluster.routing.allocation.balance.thresholdFloating pointThe minimum optimization value of operations that should be performed. Default is 1.0.
cluster.routing.allocation.balance.prefer_primaryBooleanWhen set to true, OpenSearch attempts to evenly distribute the primary shards between the cluster nodes. Enabling this setting does not always guarantee an equal number of primary shards on each node, especially in the event of failover. Changing this setting to false after it was set to true does not invoke redistribution of primary shards. Default is false.
cluster.routing.allocation.disk.threshold_enabledBooleanWhen set to false, disables the disk allocation decider. This will also remove any existing index.blocks.read_only_allow_delete index blocks when disabled. Default is true.
cluster.routing.allocation.disk.watermark.lowStringControls the low watermark for disk usage. When set to a percentage, OpenSearch will not allocate shards to nodes with that percentage of disk used. This can also be entered as ratio value, like 0.85. Finally, this can also be set to a byte value, like 400mb. This setting does not affect the primary shards of newly-created indexes, but will prevent their replicas from being allocated. Default is 85%.
cluster.routing.allocation.disk.watermark.highStringControls the high watermark. OpenSearch will attempt to relocate shards away from a node whose disk usage is above the percentage defined. This can also be entered as a ratio value, like 0.85. Finally, this can also be set to a byte value, like 400mb. This setting affects the allocation of all shards. Default is 90%.
cluster.routing.allocation.disk.watermark.flood_stageStringControls the flood stage watermark. This is a last resort to prevent nodes from running out of disk space. OpenSearch enforces a read-only index block (index.blocks.read_only_allow_delete) on every index that has one or more shards allocated on the node, and that has at least one disk exceeding the flood stage. The index block is released once the disk utilization falls below the high watermark. This can also be entered as a ratio value, like 0.85. Finally, this can also be set to a byte value, like 400mb. Default is 95%.
cluster.info.update.intervalTime unitSets how often OpenSearch should check disk usage for each node in the cluster. Default is 30s.
cluster.routing.allocation.include.EnumAllocates shards to a node whose attribute has at least one of the included comma-separated values.
cluster.routing.allocation.require.EnumOnly allocates shards to a node whose attribute has all of the included comma-separated values.
cluster.routing.allocation.exclude.EnumDoes not allocate shards to a node whose attribute has any of the included comma-separated values. The cluster allocation settings support the following built-in attributes:

_name – Match nodes by node name.

_host_ip – Match nodes by host IP address.

_publish_ip – Match nodes by publish IP address.

_ip – Match either _host_ip or _publish_ip.

_host – Match nodes by hostname.

_id – Match nodes by node ID.

_tier – Match nodes by data tier role.
cluster.blocks.read_onlyBooleanSets the entire cluster to read-only. Default is false.
cluster.blocks.read_only_allow_deleteBooleanSimilar to cluster.blocks.read_only but allows you to delete indexes.
cluster.max_shards_per_nodeIntegerLimits the total number of primary and replica shards for the cluster. The limit is calculated as follows: cluster.max_shards_per_node multiplied by the number of non-frozen data nodes. Shards for closed indexes do not count toward this limit. Default is 1000.
cluster.persistent_tasks.allocation.enableStringEnables or disables allocation for persistent tasks:

all – Allows persistent tasks to be assigned to nodes.

none – No allocations are allowed for persistent tasks. This does not affect persistent tasks already running.

Default is all.
cluster.persistent_tasks.allocation.recheck_intervalTime unitThe cluster manager automatically checks whether or not persistent tasks need to be assigned when the cluster state changes in a significant way. There are other factors, such as memory usage, that will affect whether or not persistent tasks are assigned to nodes but do not otherwise cause the cluster state to change. This setting defines how often assignment checks are performed in response to these factors. Default is 30 seconds, with a minimum of 10 seconds being required.

Example request

For a PUT operation, the request body must contain transient or persistent, along with the setting you want to update:

  1. PUT _cluster/settings
  2. {
  3. "persistent":{
  4. "cluster.max_shards_per_node": 500
  5. }
  6. }

copy

For more information about transient settings, persistent settings, and precedence, see OpenSearch configuration.

Example response

  1. {
  2. "acknowledged":true,
  3. "persistent":{
  4. "cluster":{
  5. "max_shards_per_node":"500"
  6. }
  7. },
  8. "transient":{}
  9. }

Cluster settings - 图1