package Search::Elasticsearch::Client::Direct::Cluster; $Search::Elasticsearch::Client::Direct::Cluster::VERSION = '1.16'; use Moo; with 'Search::Elasticsearch::Role::API'; with 'Search::Elasticsearch::Role::Client::Direct'; __PACKAGE__->_install_api('cluster'); sub node_info { _deprecated( 'node_info', 'info' ) } sub node_stats { _deprecated( 'node_stats', 'stats' ) } sub hot_threads { _deprecated( 'hot_threads', 'hot_threads' ) } sub node_shutdown { _deprecated( 'node_shutdown', 'shutdown' ) } #=================================== sub _deprecated { #=================================== my ( $old, $new ) = @_; die "The method \$es->cluster->$old() has moved to \$es->nodes->$new()"; } 1; =pod =encoding UTF-8 =head1 NAME Search::Elasticsearch::Client::Direct::Cluster - A client for running cluster-level requests =head1 VERSION version 1.16 =head1 DESCRIPTION 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 L. =head1 METHODS =head2 C $response = $e->cluster->health( index => 'index' | \@indices # optional ); The C method is used to retrieve information about the cluster health, returning C, C or C to indicate the state of the cluster, indices or shards. Query string parameters: C, C, C, C, C, C, C, C See the L for more information. =head2 C $response = $e->cluster->stats( node_id => 'node' | \@nodes # optional ); Returns high-level cluster stats, optionally limited to the listed nodes. Query string parameters: C, C See the L for more information. =head2 C $response = $e->cluster->get_settings() The C method is used to retrieve cluster-wide settings that have been set with the L method. Query string parameters: C, C, C See the L for more information. =head2 C $response = $e->cluster->put_settings( %settings ); The C 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 } } ); Query string parameters: C See the L for more information. =head2 C $response = $e->cluster->state( metric => $metric | \@metrics # optional index => $index | \@indices # optional ); The C method returns the current cluster state from the master node, or from the responding node if C is set to C. It returns all metrics by default, but these can be limited to any of: C<_all>, C, C, C, C Metrics for indices can be limited to particular indices with the C parameter. Query string parameters: C, C, C See the L for more information. =head2 C $response = $e->cluster->pending_tasks(); Returns a list of cluster-level tasks still pending on the master node. Query string parameters: C, C See the L for more information. =head2 C $e->cluster->reroute( body => { commands } ); The C method is used to manually reallocate shards from one node to another. The C should contain the C indicating which changes should be made. For instance: $e->cluster->reroute( 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: C, C, C, C, C See the L for more information. =head1 AUTHOR Clinton Gormley =head1 COPYRIGHT AND LICENSE This software is Copyright (c) 2014 by Elasticsearch BV. This is free software, licensed under: The Apache License, Version 2.0, January 2004 =cut __END__ # ABSTRACT: A client for running cluster-level requests