Query watches API

Query watches API

Retrieves all registered watches.

Request

GET /_watcher/_query/watches

Prerequisites

  • You must have manage_watcher or monitor_watcher cluster privileges to use this API. For more information, see Security privileges.

Retrieves all watches in a paginated manner and optionally filtering watches by a query.

This API supports the following fields:

NameRequiredDefaultDescription

from

no

0

The offset from the first result to fetch. Needs to be non-negative.

size

no

10

The number of hits to return. Needs to be non-negative.

query

no

null

Optional, query filter watches to be returned.

sort

no

null

Optional sort definition.

search_after

no

null

Optional search After to do pagination using last hit’s sort values.

Note that only the _id and metadata.* fields are queryable or sortable.

This api returns the following top level fields:

count

The total number of watches found.

watches

A list of watches based on the from, size or search_after request body parameters.

Examples

The following example list all stored watches:

  1. GET /_watcher/_query/watches

Response:

  1. {
  2. "count": 1,
  3. "watches": [
  4. {
  5. "_id": "my_watch",
  6. "watch": {
  7. "trigger": {
  8. "schedule": {
  9. "hourly": {
  10. "minute": [
  11. 0,
  12. 5
  13. ]
  14. }
  15. }
  16. },
  17. "input": {
  18. "simple": {
  19. "payload": {
  20. "send": "yes"
  21. }
  22. }
  23. },
  24. "condition": {
  25. "always": {}
  26. },
  27. "actions": {
  28. "test_index": {
  29. "index": {
  30. "index": "test"
  31. }
  32. }
  33. }
  34. },
  35. "status": {
  36. "state": {
  37. "active": true,
  38. "timestamp": "2015-05-26T18:21:08.630Z"
  39. },
  40. "actions": {
  41. "test_index": {
  42. "ack": {
  43. "timestamp": "2015-05-26T18:21:08.630Z",
  44. "state": "awaits_successful_execution"
  45. }
  46. }
  47. },
  48. "version": -1
  49. },
  50. "_seq_no": 0,
  51. "_primary_term": 1
  52. }
  53. ]
  54. }