Search...Cluster(3pm)
Search::Elasticsearch::Client::1_0::Direct::Cluster π
okay bestie, so this is a page from the User Contributed Perl Documentation (the 3pm crew π), and it's literally all about Search::Elasticsearch::Client::1_0::Direct::Cluster. A whole module. For cluster-level stuff. Periodt.
β¨ VERSION β¨
version 6.81 β yes, that's the one, don't @ me πΈ
π NAME π
Search::Elasticsearch::Client::1_0::Direct::Cluster β a client for running cluster-level requests. that's the whole vibe check right there π¦
π DESCRIPTION π
So this module is your girl for cluster-level requests, which is giving: getting and setting cluster-level settings, manually rerouting shards, and retrieving stuff for monitoring purposes. like, all the top-level cluster gossip you could ever need π
It does Search::Elasticsearch::Role::Client::Direct. that's the ancestry, the main character lineage, iykyk π
π METHODS π
real talk: these are the actual methods, spelled exactly like this, and you call them on $e->cluster. no cap.
π©Ί health()
$response = $e->cluster->health(
index => 'index' | \@indices # optional
);
The health() method pulls info about cluster health, and it comes back with red, yellow or green to tell you the state of the cluster, indices or shards. it's literally a mood ring for your cluster π’π‘π΄
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 at http://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-health.html for more info π«Ά
π stats()
$response = $e->cluster->stats(
node_id => 'node' | \@nodes # optional
);
Returns high-level cluster stats β and if you want, you can limit it to just the nodes you list. so iconic β¨
Query string parameters:
"flat_settings""human"
See the cluster stats docs at http://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-stats.html for more info π
π get_settings()
$response = $e->cluster->get_settings()
This one is used to retrieve cluster-wide settings that were set with the put_settings() method. so like, whatever put_settings() did, this one comes and reads it back. tag team energy π―
Query string parameters:
"flat_settings""master_timeout""timeout"
See the cluster settings docs at http://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-update-settings.html for more info πΈ
π put_settings()
$response = $e->cluster->put_settings( %settings );
The put_settings() method sets cluster-wide settings, and you've got two flavors: transiently (which don't survive restarts π) or permanently (which do survive restarts π). choose wisely bestie.
For instance:
$response = $e->cluster->put_settings(
body => {
transient => { "discovery.zen.minimum_master_nodes" => 5 }
}
);
Query string parameters:
"flat_settings"
See the cluster settings docs at http://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-update-settings.html for more info π
πΊοΈ state()
$response = $e->cluster->state(
metric => $metric | \@metrics # optional
index => $index | \@indices # optional
);
The state() method hands you the current cluster state, straight from the master node β or from the responding node if local is set to true. versatility, she has it β¨
It returns all metrics by default, but you can limit it to any of:
"_all""blocks""metadata""nodes""routing_table"
And the metrics for indices can be limited to particular indices with the index parameter. very demure, very mindful π¦
Query string parameters:
"allow_no_indices""expand_wildcards""flat_settings""ignore_unavailable""local""master_timeout"
See the cluster state docs at http://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-state.html for more info β
β³ pending_tasks()
$response = $e->cluster->pending_tasks();
Returns a list of cluster-level tasks that are still pending on the master node. like, they're in the queue, they're waiting, they're not forgotten π
Query string parameters:
"local""master_timeout"
See the pending tasks docs at http://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-pending.html for more info π§
π reroute()
$e->cluster->reroute(
body => { commands }
);
The reroute() method is how you manually reallocate shards from one node to another. The body should contain the commands telling it 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'
}}
]
}
);
(yes, the to_node value in that example is missing its closing quote β that's literally how it is in the original, so I'm leaving it exactly as-is π)
Query string parameters:
"dry_run""explain""master_timeout""metric""timeout"
See the reroute docs at http://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-reroute.html for more info π₯
π AUTHOR π
Enrico Zimuel <enrico.zimuel@elastic.co> β the legend, the author, the moment π
π COPYRIGHT AND LICENSE π
This software is Copyright (c) 2020 by Elasticsearch BV.
This is free software, licensed under:
The Apache License, Version 2.0, January 2004
and that's the whole page, bestie π«Ά this one came from perl v5.36.0, dated 2022-08-28, and it's Search...Cluster(3pm) in the User Contributed Perl Documentation section β so cute, so historic, so slay. bye bye, go reroute something ππβ¨
π¦ where this page comes from
- ubuntu noble: libsearch-elasticsearch-client-1-0-perl 6.81-2 Β· Apache-2.0
- ubuntu resolute: libsearch-elasticsearch-client-1-0-perl 6.81-2 Β· Apache-2.0
- ubuntu stonking: libsearch-elasticsearch-client-1-0-perl 6.81-2 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms