From fbee380daeeb8cce02751063d14392963c25b670 Mon Sep 17 00:00:00 2001 From: Lisa Cawley Date: Thu, 7 Oct 2021 08:34:58 -0700 Subject: [PATCH 1/2] [DOCS] Fixes ML get scheduled events API (#78809) --- .../ml/apis/get-calendar-event.asciidoc | 40 ++++++++++++++++++- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/docs/reference/ml/apis/get-calendar-event.asciidoc b/docs/reference/ml/apis/get-calendar-event.asciidoc index c8d614f57caf3..6f2f98ede9d0c 100644 --- a/docs/reference/ml/apis/get-calendar-event.asciidoc +++ b/docs/reference/ml/apis/get-calendar-event.asciidoc @@ -27,15 +27,42 @@ calendars by using `_all`. `calendar_id` (required):: (string) Identifier for the calendar. +==== Query Parameters + +`end`:: + (Optional, string) Specifies to get events with timestamps earlier than this + time. + +`from`:: + (Optional, integer) Skips the specified number of events. Defaults to `0`. + +`job_id`:: + (Optional, string) Specifies to get events for a specific {anomaly-job} + identifier or job group. It must be used with a calendar identifier of `_all` + or `*`. + +`size`:: + (Optional, integer) Specifies the maximum number of events to obtain. Defaults + to `100`. + +`start`:: + (Optional, string) Specifies to get events with timestamps after this time. + + ==== Request Body `end`:: (string) Specifies to get events with timestamps earlier than this time. -`from`:: +`job_id`:: + (string) Specifies to get events for a specific {anomaly-job} + identifier or job group. It must be used with a calendar identifier of `_all` + or `*`. + +`page.from`:: (integer) Skips the specified number of events. -`size`:: +`page.size`:: (integer) Specifies the maximum number of events to obtain. `start`:: @@ -105,3 +132,12 @@ The API returns the following results: // TESTRESPONSE[s/Ly8LJGEBMTCMA-qz49st/$body.$_path/] For more information about these properties, see <>. + +The following example retrieves scheduled events that occur within a specific +period of time: + +[source,console] +-------------------------------------------------- +GET _ml/*/planned-outages/events?start=1635638400000&end=1635724800000 +-------------------------------------------------- +// TEST[skip:setup:calendar_outages_addevent] \ No newline at end of file From 8f8eb062750115b838394e87f0d95d8cd53a4348 Mon Sep 17 00:00:00 2001 From: lcawl Date: Thu, 7 Oct 2021 16:41:45 -0700 Subject: [PATCH 2/2] [DOCS] Removes request body --- .../ml/apis/get-calendar-event.asciidoc | 25 ++----------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/docs/reference/ml/apis/get-calendar-event.asciidoc b/docs/reference/ml/apis/get-calendar-event.asciidoc index 6f2f98ede9d0c..98419e0eb1e62 100644 --- a/docs/reference/ml/apis/get-calendar-event.asciidoc +++ b/docs/reference/ml/apis/get-calendar-event.asciidoc @@ -38,8 +38,7 @@ calendars by using `_all`. `job_id`:: (Optional, string) Specifies to get events for a specific {anomaly-job} - identifier or job group. It must be used with a calendar identifier of `_all` - or `*`. + identifier or job group. It must be used with a calendar identifier of `_all`. `size`:: (Optional, integer) Specifies the maximum number of events to obtain. Defaults @@ -48,26 +47,6 @@ calendars by using `_all`. `start`:: (Optional, string) Specifies to get events with timestamps after this time. - -==== Request Body - -`end`:: - (string) Specifies to get events with timestamps earlier than this time. - -`job_id`:: - (string) Specifies to get events for a specific {anomaly-job} - identifier or job group. It must be used with a calendar identifier of `_all` - or `*`. - -`page.from`:: - (integer) Skips the specified number of events. - -`page.size`:: - (integer) Specifies the maximum number of events to obtain. - -`start`:: - (string) Specifies to get events with timestamps after this time. - ==== Results The API returns the following information: @@ -138,6 +117,6 @@ period of time: [source,console] -------------------------------------------------- -GET _ml/*/planned-outages/events?start=1635638400000&end=1635724800000 +GET _xpack/ml/calendars/planned-outages/events?start=1635638400000&end=1635724800000 -------------------------------------------------- // TEST[skip:setup:calendar_outages_addevent] \ No newline at end of file