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, _host_ip, _publish_ip, _ip, _host and _id 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 name


Match nodes by host IP address (IP associated with hostname)


Match nodes by publish IP address


Match either _host_ip or _publish_ip


Match nodes by hostname


Match nodes by node id

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

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