Search::Elasticsearch::Client::0_90::Direct::Cluster - A client for running cluster-level requests


version 6.80


This module provides methods to make cluster-level requests, such as getting and setting cluster-level settings, manually rerouting shards, and retrieving for monitoring purposes.

It does Search::Elasticsearch::Role::Client::Direct.



    $response = $e->cluster->health( %qs_params )

The health() method is used to retrieve information about the cluster health, returning red, yellow or green to indicate the state of the cluster, indices or shards.

Query string parameters: level, local, master_timeout, timeout, wait_for_active_shards, wait_for_nodes, wait_for_relocating_shards, wait_for_status

See the cluster health docs for more information.


    $response = $e->cluster->pending_tasks();

Returns a list of cluster-level tasks still pending on the master node.

Query string parameters: local, master_timeout

See the pending tasks docs for more information.


    $response = $e->cluster->node_info(
        node_id => $node_id | \@node_ids       # optional

The node_info() method returns static information about the nodes in the cluster, such as the configured maximum number of file handles, the maximum configured heap size or the threadpool settings.

Query string parameters: all, clear, http, jvm, network, os, plugin, process, settings, thread_pool, timeout, transport

See the node_info docs for more information.


    $response = $e->cluster->node_stats(
        node_id => $node_id | \@node_ids       # optional

The node_stats() method returns statistics about the nodes in the cluster, such as the number of currently open file handles, the current heap memory usage or the current number of threads in use.

Stats can be returned for all nodes, or limited to particular nodes with the node_id parameter. The indices_stats information can also be retrieved on a per-node basis with the node_stats() method:

    $response = $e->cluster->node_stats(
        node_id => 'node_1',
        indices => 1,
        metric  => 'docs'

Query string parameters: all, clear, fields, fs, http, indices, jvm, network, os, process, thread_pool, transport

See the node_stats docs for more information.


    $response = $e->cluster->hot_threads(
        node_id => $node_id | \@node_ids       # optional

The hot_threads() method is a useful tool for diagnosing busy nodes. It takes a snapshot of which threads are consuming the most CPU.

Query string parameters: interval, snapshots, threads, type

See the hot_threads docs for more information.


    $response = $e->cluster->get_settings()

The get_settings() method is used to retrieve cluster-wide settings that have been set with the "put_settings()" method.

See the cluster settings docs for more information.


    $response = $e->cluster->put_settings( %settings );

The put_settings() method is used to set cluster-wide settings, either transiently (which don't survive restarts) or permanently (which do survive restarts).

For instance:

    $response = $e->cluster->put_settings(
        body => {
            transient => { "discovery.zen.minimum_master_nodes" => 5 }

See the cluster settings docs for more information.


    $response = $e->cluster->state();

The state() method returns the current cluster state from the master node, or from the responding node if local is set to true.

Query string parameters: filter_blocks, filter_index_templates, filter_indices, filter_metadata, filter_nodes, filter_routing_table, local, master_timeout

See the cluster state docs for more information.


        body => { commands }    # required

The reroute() method is used to manually reallocate shards from one node to another. The body should contain the commands indicating which changes should be made. For instance:

        body => {
            commands => [
                { move => {
                    index     => 'test',
                    shard     => 0,
                    from_node => 'node_1',
                    to_node   => 'node_2
                { allocate => {
                    index     => 'test',
                    shard     => 1,
                    node      => 'node_3'

Query string parameters: dry_run, filter_metadata

See the reroute docs for more information.


        node_id => $node_id | \@node_ids    # optional

The shutdown() method is used to shutdown one or more nodes, or the whole cluster.

Query string parameters: delay, exit

See the shutdown docs for more information.


Enrico Zimuel <>


This software is Copyright (c) 2020 by Elasticsearch BV.

This is free software, licensed under:

  The Apache License, Version 2.0, January 2004