Search...Watcher(3pm)
π NAME π
okay bestie, so Search::Elasticsearch::Client::7_0::Direct::Watcher is the plugin that hands you the whole Watcher API for Search::Elasticsearch 7.x. that's it. that's the whole job. it's giving "alerts but make it perl". π
β¨ VERSION β¨
version 7.715 β yes she has a version number and yes she's proud of it. π
πΈ SYNOPSIS πΈ
my $response = $es->watcher->start();
that's it. one line. we love a low-effort entrance. π
π¦ DESCRIPTION π¦
so this class extends the Search::Elasticsearch client with a "watcher" namespace, and that namespace is what gives you the Watcher APIs. like, that's the whole vibe:
https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api.html
extend client β get namespace β get power. iconic. π
π METHODS π
the full documentation for the Watcher feature lives right here if you want the deep lore:
https://www.elastic.co/guide/en/x-pack/current/xpack-alerting.html
π put_watch()
$response = $es->watcher->put_watch(
id => $watch_id, # required
body => {...}
);
put_watch() is your girl for registering a brand new watcher, or for updating one that already exists. either way, she's handling it. π
peep the put_watch docs if you want more:
https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-put-watch.html
query string parameters, bestie β here's the list, all of them, no skips:
"active""error_trace""human""if_primary_term""if_seq_no""master_timeout""version"
π§ get_watch()
$response = $es->watcher->get_watch(
id => $watch_id, # required
);
get_watch() retrieves a watch by its ID. simple, clean, no drama. β¨
the get_watch docs:
https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-get-watch.html
query string parameters:
"error_trace""human"
π delete_watch()
$response = $es->watcher->delete_watch(
id => $watch_id, # required
);
delete_watch() deletes a watch by its ID. gone. bye. no cap. π
query string parameters:
"error_trace""force""human""master_timeout"
and the delete_watch docs, for the receipts:
https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-delete-watch.html
π execute_watch()
$response = $es->watcher->execute_watch(
id => $watch_id, # optional
body => {...} # optional
);
execute_watch() forces a previously registered watch to actually run. yes, like manually poking it. and ngl, the optional params get passed in the body. π₯
query string parameters:
"debug""error_trace""human"
execute_watch docs:
https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-execute-watch.html
π ack_watch()
$response = $es->watcher->ack_watch(
watch_id => $watch_id, # required
action_id => $action_id | \@action_ids # optional
);
ack_watch() is how you manually throttle the execution of a watch. she's the brakes, bestie. π
query string parameters:
"error_trace""human""master_timeout"
ack_watch docs:
https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-ack-watch.html
β activate_watch()
$response = $es->watcher->activate_watch(
watch_id => $watch_id, # required
);
activate_watch() activates a deactive watch. wake her up, she's got main character energy to get back to. π
query string parameters:
"error_trace""human""master_timeout"
activate_watch docs:
https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-activate-watch.html
π deactivate_watch()
$response = $es->watcher->deactivate_watch(
watch_id => $watch_id, # required
);
deactivate_watch() deactivates an active watch. nap time. she earned it. π΄
query string parameters:
"error_trace""human""master_timeout"
deactivate_watch docs:
https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-deactivate-watch.html
π«Ά stats()
$response = $es->watcher->stats(
metric => $metric # optional
);
stats() gives you the tea on the status of the watcher plugin. iykyk. β
stats docs:
https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-stats.html
query string parameters:
"error_trace""human"
π stop()
$response = $es->watcher->stop();
stop() stops the watcher service β but only if it's running. if she's already off, she stays off. π€·
stop docs:
https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-stop.html
query string parameters:
"error_trace""human"
β¨ start()
$response = $es->watcher->start();
start() starts the watcher service if it's not already running. and if it is already running? she doesn't double-start. respectful. π
start docs:
https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-start.html
query string parameters:
"error_trace""human"
π¦ restart()
$response = $es->watcher->restart();
restart() stops and then starts the watcher service. the classic glow-up arc: she leaves, she comes back better. periodt. π
restart docs:
https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-restart.html
query string parameters:
"error_trace""human"
πΈ AUTHOR πΈ
Enrico Zimuel <enrico.zimuel@elastic.co> β shoutout to the legend, no cap. π«Ά
π COPYRIGHT AND LICENSE π
this software is Copyright (c) 2021 by Elasticsearch BV.
and it's free software, licensed under:
The Apache License, Version 2.0, January 2004
and that's the whole page bestie, you ate it. π this beauty is running on perl v5.32.1, dated 2021-10-23, and she goes by Search...Watcher(3pm). mwah. πβ¨
π¦ where this page comes from
- ubuntu jammy: libsearch-elasticsearch-perl 7.715-1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms