Method: Elasticsearch::API::Cluster::Actions#reroute

Defined in:
lib/elasticsearch/api/actions/cluster/reroute.rb

#reroute(arguments = {}) ⇒ Object

Note:

If you want to explicitely set the shard allocation to a certain node, you might want to look at the allocation.* cluster settings.

Perform manual shard allocation in the cluster.

Pass the operations you want to perform in the :body option. Use the dry_run option to evaluate the result of operations without actually performing them.

Examples:

Move shard 0 of index myindex from node named Node1 to node named Node2


client.cluster.reroute body: {
  commands: [
    { move: { index: 'myindex', shard: 0, from_node: 'Node1', to_node: 'Node2' } }
  ]
}

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :body (Hash)

    The definition of commands to perform (move, cancel, allocate)

  • :dry_run (Boolean)

    Simulate the operation only and return the resulting state

  • :filter_metadata (Boolean)

    Don’t return cluster state metadata (default: false)

See Also:



28
29
30
31
32
33
34
35
36
37
38
# File 'lib/elasticsearch/api/actions/cluster/reroute.rb', line 28

def reroute(arguments={})
  valid_params = [ :dry_run, :filter_metadata ]

  method = 'POST'
  path   = "_cluster/reroute"

  params = Utils.__validate_and_extract_params arguments, valid_params
  body   = arguments[:body] || {}

  perform_request(method, path, params, body).body
end