Search...Watcher(3pm)

πŸ“¦
version 8.12 Β· 4 versions
, in debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ‘‘ NAME πŸ‘‘

okay so bestie, welcome to Search::Elasticsearch::Client::8_0::Direct::Watcher β€” it's a plugin that hands you the whole Watcher API for Search::Elasticsearch 8.x 🫢 this is the manual page for it, yes the whole thing, and we're getting through it together πŸ’–


πŸŽ€ VERSION πŸŽ€

version 8.12 ✨ (yes she's serving 8.12, no cap)


🌸 SYNOPSIS 🌸

the vibe, in one line:

my $response = $es->watcher->start();

that's it. that's the whole first look. slay πŸ’…


πŸ’– DESCRIPTION πŸ’–

so this class goes and extends the Search::Elasticsearch client with a whole watcher namespace, specifically so you can talk to the Watcher APIs πŸ”₯

the docs for those live right here: https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api.html

literally everything else is just methods. let's go 🌈


πŸ¦‹ METHODS πŸ¦‹

the full documentation for the whole Watcher feature is chilling at:

https://www.elastic.co/guide/en/x-pack/current/xpack-alerting.html

okay now the actual methods, one by one, no skipping, i promised 🫑


✨ put_watch() ✨

$response = $es->watcher->put_watch(
    id    => $watch_id,     # required
    body  => {...}
);

put_watch() is the one you call to register a brand new watcher, or to update one that already exists. glow-up in either direction πŸ’…

more info in the put_watch docs: https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-put-watch.html

Query string parameters:

  • 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() pulls up a watch by ID. like, "hey, show me that watch," and it does πŸŽ€

more info in 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 ID. gone. not me being dramatic, that's genuinely what it does 😭

Query string parameters:

  • error_trace
  • force
  • human
  • master_timeout

more info in the delete_watch docs: 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 run. like hitting "go" on a post you've been drafting forever. and hey β€” optional params can be passed in the body πŸ‘€

Query string parameters:

  • debug
  • error_trace
  • human

more info in the 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. sometimes a girl just needs to slow things down, iykyk 🧚

Query string parameters:

  • error_trace
  • human
  • master_timeout

more info in the 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. waking her up. main character energy restored πŸ‘‘

Query string parameters:

  • error_trace
  • human
  • master_timeout

more info in the 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 bestie, she earned it 😴

Query string parameters:

  • error_trace
  • human
  • master_timeout

more info in the 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() hands back info about the status of the watcher plugin. the receipts, basically 🧾✨

more info in the 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 if it is running. if it's not running, well. nothing to do 🀷

more info in the 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 is not already running. iconic behaviour honestly 🌟

more info in the 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 then starts the watcher service. out with the old, in with the new, periodt πŸ’…

more info in the 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 author fr fr, they ate


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

This is free software, licensed under:

The Apache License, Version 2.0, January 2004
okay so real talk: it's free software, the license above is the actual license, keep it intact bestie πŸ’–

and that's the whole page!! this manual page for Search...Watcher(3pm) was served up by perl v5.38.2 on 2024-02-04 🌸 thanks for reading, go write some watches, you're gonna slay βœ¨πŸ’…πŸ¦‹

πŸ“¦ where this page comes from