CPA
CPA

Reputation: 3053

Remove shard allocation filter

I have set a shard allocation filter like:

    PUT _cluster/settings
{
  "transient" : {
    "cluster.routing.allocation.exclude._name" : "node-1"
  }
}

How can I remove or disable such a setting? I tried with include, but then I have both filter setted - include and exclude. I can set something like "cluster.routing.allocation.exclude._name" : "".

But is it also possible to set something like: include all nodes?

Upvotes: 6

Views: 6756

Answers (3)

Paulin Trognon
Paulin Trognon

Reputation: 813

Have you tried

PUT _cluster/settings
{
  "transient" : {
    "cluster.routing.allocation.exclude._name" : null
  }
}

Sounds dumb, but I think that's how you unset things in elasticsearch...

Upvotes: 11

Timost
Timost

Reputation: 81

For the clusters running on Elasticsearch 5.x, you can pass null values to reset a setting. As said in this issue, this is documented for cluster level settings but not for the index level settings.

So you can do:

PUT _cluster/settings
{
   "transient" : {
       "cluster.routing.allocation.exclude._name" : null
   }
}

And also:

PUT test-index/_settings
{
  "index": {
    "routing": {
      "allocation": {
        "include": {
          "box_type": null
        },
        "exclude": {
          "box_type": null
        },
        "require": {
          "box_type": null
        },
        "total_shards_per_node": "2"
      }
    }
  }
}

Upvotes: 8

CPA
CPA

Reputation: 3053

To reset the include filter and include all nodes, you have to use both settings:

PUT _cluster/settings
{
  "transient" : {
    "cluster.routing.allocation.include._name" : ""
  }
}

and

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

Upvotes: 3

Related Questions