Search...Cluster(3pm)

πŸ“¦ version 7.715, in ubuntu jammy

✨ Search::Elasticsearch::Client::7_0::Direct::Cluster ✨

okay bestie, welcome to the Search...Cluster(3pm) page, aka the manual for Search::Elasticsearch::Client::7_0::Direct::Cluster β€” the lil module that lets you run cluster-level requests. πŸ’–

🌸 VERSION 🌸

version 7.715 β€” yeah she's on 7.715, keep up πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

This module hands you the methods to make cluster-level requests, like:

  • grabbing and setting cluster-level settings
  • manually rerouting shards
  • retrieving stuff for monitoring purposes

She also does Search::Elasticsearch::Role::Client::Direct, so that's the role energy she's bringing to the group chat. ✨


πŸ‘‘ METHODS πŸ‘‘

🩺 health()

$response = $e->cluster->health(
    index   => 'index' | \@indices  # optional
);

The health() method pulls up info about the cluster health, and it'll hand you back red, yellow or green to tell you what's going on with the cluster, the indices, or the shards. it's giving traffic light but make it distributed systems 🚦

Query string parameters:

  • "error_trace"
  • "human"
  • "level"
  • "local"
  • "master_timeout"
  • "timeout"
  • "wait_for_active_shards"
  • "wait_for_events"
  • "wait_for_no_initializing_shards"
  • "wait_for_no_relocating_shards"
  • "wait_for_nodes"
  • "wait_for_status"

See the cluster health docs http://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-health.html for more info, iykyk 🫢


πŸ“Š stats()

$response = $e->cluster->stats(
    node_id => 'node' | \@nodes     # optional
);

Returns high-level cluster stats, optionally limited to the nodes you list. cute AND filtered, we love a scoped queen ✨

Query string parameters:

  • "error_trace"
  • "flat_settings"
  • "human"
  • "timeout"

See the cluster stats docs http://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-stats.html for more information πŸ’œ


πŸ” get_settings()

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

The get_settings() method retrieves the cluster-wide settings that were set with the put_settings() method. it's literally the read half of the situationship, no cap πŸ“–

Query string parameters:

  • "error_trace"
  • "flat_settings"
  • "human"
  • "include_defaults"
  • "master_timeout"
  • "timeout"

See the cluster settings docs http://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-update-settings.html for more information πŸŽ€


✍️ put_settings()

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

The put_settings() method sets cluster-wide settings, and you've got two flavours:

  • transiently β€” these do not survive restarts 😭
  • permanently β€” these do survive restarts, main character energy πŸ‘‘

For instance:

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

Query string parameters:

  • "error_trace"
  • "flat_settings"
  • "human"

See the cluster settings docs http://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-update-settings.html for more information 🌸


πŸ—ΊοΈ state()

$response = $e->cluster->state(
    metric => $metric | \@metrics   # optional
    index  => $index  | \@indices   # optional
);

The state() method returns the current cluster state from the master node β€” or from the responding node if local is set to true. your call, bestie πŸ’…

It returns all metrics by default, but you can limit them to any of:

  • "_all"
  • "blocks"
  • "metadata"
  • "nodes"
  • "routing_table"

Metrics for indices can be limited to particular indices with the index parameter. so specific ✨

Query string parameters:

  • "allow_no_indices"
  • "error_trace"
  • "expand_wildcards"
  • "flat_settings"
  • "human"
  • "ignore_unavailable"
  • "local"
  • "master_timeout"
  • "wait_for_metadata_version"
  • "wait_for_timeout"

See the cluster state docs http://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-state.html for more information πŸ¦‹


🧐 allocation_explain()

$response = $e->cluster->allocation_explain(
    body => { ... shard selectors ...}  # optional
);

Returns info about why a shard is allocated or unallocated β€” or why. yeah she's nosy, she explains the whole lore πŸ“

Query string parameters:

  • "error_trace"
  • "human"
  • "include_disk_info"
  • "include_yes_decisions"

See the cluster allocation explain docs https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-allocation-explain.html for more information πŸ‘‘


⏳ pending_tasks()

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

Returns a list of cluster-level tasks still pending on the master node. the master node is lowkey going through it πŸ’€

Query string parameters:

  • "error_trace"
  • "human"
  • "local"
  • "master_timeout"

See the pending tasks docs http://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-pending.html for more information 🌈


πŸ”€ reroute()

$e->cluster->reroute(
    body => { commands }
);

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:

$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:

  • "dry_run"
  • "error_trace"
  • "explain"
  • "human"
  • "master_timeout"
  • "metric"
  • "retry_failed"
  • "timeout"

See the reroute docs http://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-reroute.html for more information πŸ”₯


🌐 remote_info()

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

The remote_info() API retrieves all of the configured remote cluster information. long-distance relationships but make it clusters πŸ’–

Query string parameters:

  • "error_trace"
  • "human"

See the remote_info docs https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-remote-info.html for more information 🫢


πŸ’œ AUTHOR πŸ’œ

Enrico Zimuel <enrico.zimuel@elastic.co> β€” shoutout to the author, iconic ✨


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

This is free software, licensed under:

The Apache License, Version 2.0, January 2004

and that's the whole page bestie, no skips, no summaries, every single param accounted for πŸŽ€

perl v5.32.1 Β· 2021-10-23 β€” that's the version and date this page was born, and it's still serving Search...Cluster(3pm) realness. stay slaying, go reroute something responsibly πŸ’…πŸ’–

πŸ“¦ where this page comes from