Cluster-level shard allocation filteringedit

You can use cluster-level shard allocation filters to control where Elasticsearch allocates shards from any index. These cluster wide filters are applied in conjunction with per-index allocation filtering and allocation awareness.

Shard allocation filters can be based on custom node attributes or the built-in _name, _ip, and _host attributes.

The cluster.routing.allocation settings are dynamic, enabling live indices to be moved from one set of nodes to another. Shards are only relocated if it is possible to do so without breaking another routing constraint, such as never allocating a primary and replica shard on the same node.

The most common use case for cluster-level shard allocation filtering is when you want to decommission a node. To move shards off of a node prior to shutting it down, you could create a filter that excludes the node by its IP address:

PUT _cluster/settings
  "transient" : {
    "cluster.routing.allocation.exclude._ip" : ""

Cluster routing settingsedit

Allocate shards to a node whose {attribute} has at least one of the comma-separated values.
Only allocate shards to a node whose {attribute} has all of the comma-separated values.
Do not allocate shards to a node whose {attribute} has any of the comma-separated values.

The cluster allocation settings support the following built-in attributes:


Match nodes by node names


Match nodes by IP addresses (the IP address associated with the hostname)


Match nodes by hostnames

You can use wildcards when specifying attribute values, for example:

PUT _cluster/settings
  "transient": {
    "cluster.routing.allocation.exclude._ip": "192.168.2.*"