get-calendar-event.asciidoc 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. [role="xpack"]
  2. [testenv="platinum"]
  3. [[ml-get-calendar-event]]
  4. = Get scheduled events API
  5. ++++
  6. <titleabbrev>Get scheduled events</titleabbrev>
  7. ++++
  8. Retrieves information about the scheduled events in calendars.
  9. [[ml-get-calendar-event-request]]
  10. == {api-request-title}
  11. `GET _ml/calendars/<calendar_id>/events` +
  12. `GET _ml/calendars/_all/events`
  13. [[ml-get-calendar-event-prereqs]]
  14. == {api-prereq-title}
  15. Requires the `monitor_ml` cluster privilege. This privilege is included in the
  16. `machine_learning_user` built-in role.
  17. [[ml-get-calendar-event-desc]]
  18. == {api-description-title}
  19. You can get scheduled event information for multiple calendars in a single
  20. API request by using a comma-separated list of ids or a wildcard expression.
  21. You can get scheduled event information for all calendars by using `_all`,
  22. by specifying `*` as the `<calendar_id>`, or by omitting the `<calendar_id>`.
  23. For more information, see
  24. {ml-docs}/ml-calendars.html[Calendars and scheduled events].
  25. [[ml-get-calendar-event-path-parms]]
  26. == {api-path-parms-title}
  27. `<calendar_id>`::
  28. (Required, string)
  29. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=calendar-id]
  30. [[ml-get-calendar-event-request-body]]
  31. == {api-request-body-title}
  32. `end`::
  33. (Optional, string) Specifies to get events with timestamps earlier than this
  34. time. Defaults to unset, which means results are not
  35. limited to specific timestamps.
  36. `from`::
  37. (Optional, integer) Skips the specified number of events. Defaults to `0`.
  38. `size`::
  39. (Optional, integer) Specifies the maximum number of events to obtain.
  40. Defaults to `100`.
  41. `start`::
  42. (Optional, string) Specifies to get events with timestamps after this time.
  43. Defaults to unset, which means results are not limited to
  44. specific timestamps.
  45. [[ml-get-calendar-event-results]]
  46. == {api-response-body-title}
  47. The API returns an array of scheduled event resources, which have the
  48. following properties:
  49. `calendar_id`::
  50. (string)
  51. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=calendar-id]
  52. `description`::
  53. (string) A description of the scheduled event.
  54. `end_time`::
  55. (date) The timestamp for the end of the scheduled event in milliseconds since
  56. the epoch or ISO 8601 format.
  57. `event_id`::
  58. (string) An automatically-generated identifier for the scheduled event.
  59. `start_time`::
  60. (date) The timestamp for the beginning of the scheduled event in milliseconds
  61. since the epoch or ISO 8601 format.
  62. [[ml-get-calendar-event-example]]
  63. == {api-examples-title}
  64. [source,console]
  65. --------------------------------------------------
  66. GET _ml/calendars/planned-outages/events
  67. --------------------------------------------------
  68. // TEST[skip:setup:calendar_outages_addevent]
  69. The API returns the following results:
  70. [source,console-result]
  71. ----
  72. {
  73. "count": 3,
  74. "events": [
  75. {
  76. "description": "event 1",
  77. "start_time": 1513641600000,
  78. "end_time": 1513728000000,
  79. "calendar_id": "planned-outages",
  80. "event_id": "LS8LJGEBMTCMA-qz49st"
  81. },
  82. {
  83. "description": "event 2",
  84. "start_time": 1513814400000,
  85. "end_time": 1513900800000,
  86. "calendar_id": "planned-outages",
  87. "event_id": "Li8LJGEBMTCMA-qz49st"
  88. },
  89. {
  90. "description": "event 3",
  91. "start_time": 1514160000000,
  92. "end_time": 1514246400000,
  93. "calendar_id": "planned-outages",
  94. "event_id": "Ly8LJGEBMTCMA-qz49st"
  95. }
  96. ]
  97. }
  98. ----
  99. // TESTRESPONSE[s/LS8LJGEBMTCMA-qz49st/$body.$_path/]
  100. // TESTRESPONSE[s/Li8LJGEBMTCMA-qz49st/$body.$_path/]
  101. // TESTRESPONSE[s/Ly8LJGEBMTCMA-qz49st/$body.$_path/]