get-calendar.asciidoc 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. [role="xpack"]
  2. [[ml-get-calendar]]
  3. = Get calendars API
  4. ++++
  5. <titleabbrev>Get calendars</titleabbrev>
  6. ++++
  7. Retrieves configuration information for calendars.
  8. [[ml-get-calendar-request]]
  9. == {api-request-title}
  10. `GET _ml/calendars/<calendar_id>` +
  11. `GET _ml/calendars/_all`
  12. [[ml-get-calendar-prereqs]]
  13. == {api-prereq-title}
  14. Requires the `monitor_ml` cluster privilege. This privilege is included in the
  15. `machine_learning_user` built-in role.
  16. [[ml-get-calendar-desc]]
  17. == {api-description-title}
  18. For more information, see
  19. {ml-docs}/ml-ad-run-jobs.html#ml-ad-calendars[Calendars and scheduled events].
  20. [[ml-get-calendar-path-parms]]
  21. == {api-path-parms-title}
  22. `<calendar_id>`::
  23. (Required, string)
  24. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=calendar-id]
  25. +
  26. You can get information for multiple calendars in a single API request by using
  27. a comma-separated list of ids or a wildcard expression. You can get information
  28. for all calendars by using `_all`, by specifying `*` as the calendar identifier,
  29. or by omitting the identifier.
  30. [[ml-get-calendar-query-parms]]
  31. == {api-query-parms-title}
  32. `from`::
  33. (Optional, integer) Skips the specified number of calendars. This parameter
  34. is supported only when you omit the `<calendar_id>`. Defaults to `0`.
  35. `size`::
  36. (Optional, integer) Specifies the maximum number of calendars to obtain.
  37. This parameter is supported only when you omit the `<calendar_id>`. Defaults
  38. to `100`.
  39. [[ml-get-calendar-request-body]]
  40. == {api-request-body-title}
  41. `page`::
  42. +
  43. .Properties of `page`
  44. [%collapsible%open]
  45. ====
  46. `from`:::
  47. (Optional, integer) Skips the specified number of calendars. This object is
  48. supported only when you omit the `<calendar_id>`. Defaults to `0`.
  49. `size`:::
  50. (Optional, integer) Specifies the maximum number of calendars to obtain. This
  51. object is supported only when you omit the `<calendar_id>`. Defaults to `100`.
  52. ====
  53. [[ml-get-calendar-results]]
  54. == {api-response-body-title}
  55. The API returns an array of calendar resources, which have the following
  56. properties:
  57. `calendar_id`::
  58. (string)
  59. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=calendar-id]
  60. `job_ids`::
  61. (array) An array of {anomaly-job} identifiers. For example:
  62. `["total-requests"]`.
  63. [[ml-get-calendar-example]]
  64. == {api-examples-title}
  65. [source,console]
  66. --------------------------------------------------
  67. GET _ml/calendars/planned-outages
  68. --------------------------------------------------
  69. // TEST[skip:setup:calendar_outages_addjob]
  70. The API returns the following results:
  71. [source,console-result]
  72. ----
  73. {
  74. "count": 1,
  75. "calendars": [
  76. {
  77. "calendar_id": "planned-outages",
  78. "job_ids": [
  79. "total-requests"
  80. ]
  81. }
  82. ]
  83. }
  84. ----