Skip to content

Commit 0911396

Browse files
committed
[ML] Correct small inconsistencies in ml APIs spec and docs (elastic#39801)
1 parent 2d64346 commit 0911396

File tree

7 files changed

+36
-6
lines changed

7 files changed

+36
-6
lines changed

docs/reference/ml/apis/eventresource.asciidoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ An events resource has the following properties:
1313
(string) A description of the scheduled event.
1414

1515
`end_time`::
16-
(string) The timestamp for the end of the scheduled event. The datetime string
17-
is in ISO 8601 format.
16+
(date) The timestamp for the end of the scheduled event
17+
in milliseconds since the epoch or ISO 8601 format.
1818

1919
`event_id`::
2020
(string) An automatically-generated identifier for the scheduled event.
2121

2222
`start_time`::
23-
(string) The timestamp for the beginning of the scheduled event. The datetime
24-
string is in ISO 8601 format.
23+
(date) The timestamp for the beginning of the scheduled event
24+
in milliseconds since the epoch or ISO 8601 format.
2525

2626
For more information, see
2727
{xpack-ref}/ml-calendars.html[Calendars and Scheduled Events].

docs/reference/ml/apis/get-calendar.asciidoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ You can get information for a single calendar or for all calendars by using
3030

3131
==== Request Body
3232

33+
`page`::
3334
`from`:::
3435
(integer) Skips the specified number of calendars.
3536

docs/reference/ml/apis/post-calendar-event.asciidoc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ of which must have a start time, end time, and description.
2727
==== Request Body
2828

2929
`events`::
30-
(array) A list of one of more scheduled events. See <<ml-event-resource>>.
30+
(array) A list of one of more scheduled events. The event's start and end times
31+
may be specified as integer milliseconds since the epoch or as a string in ISO 8601
32+
format. See <<ml-event-resource>>.
3133

3234

3335
==== Authorization

x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestDeleteForecastAction.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ public RestDeleteForecastAction(Settings settings, RestController controller) {
3636
"}/_forecast/{" + Forecast.FORECAST_ID.getPreferredName() + "}", this,
3737
DELETE, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() +
3838
"}/_forecast/{" + Forecast.FORECAST_ID.getPreferredName() + "}", deprecationLogger);
39+
controller.registerHandler(
40+
DELETE, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() +
41+
"}/_forecast/", this);
3942
}
4043

4144
@Override

x-pack/plugin/src/test/resources/rest-api-spec/api/ml.get_calendars.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
}
2525
}
2626
},
27-
"body": null
27+
"body": {
28+
"description": "The from and size parameters optionally sent in the body"
29+
}
2830
}
2931
}

x-pack/plugin/src/test/resources/rest-api-spec/test/ml/calendar_crud.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,20 @@
127127
- length: { calendars: 1}
128128
- match: { calendars.0.calendar_id: calendar2 }
129129

130+
- do:
131+
ml.get_calendars:
132+
body: >
133+
{
134+
"page": {
135+
"from": 1,
136+
"size": 2
137+
}
138+
}
139+
- match: { count: 3 }
140+
- length: { calendars: 2}
141+
- match: { calendars.0.calendar_id: calendar2 }
142+
- match: { calendars.1.calendar_id: calendar3 }
143+
130144
---
131145
"Test PageParams with ID is invalid":
132146
- do:

x-pack/plugin/src/test/resources/rest-api-spec/test/ml/delete_forecast.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,3 +137,11 @@ setup:
137137
forecast_id: _all
138138
allow_no_forecasts: true
139139
- match: { acknowledged: true }
140+
141+
---
142+
"Test delete all where no forecast_id is set":
143+
- do:
144+
ml.delete_forecast:
145+
job_id: delete-forecast-job
146+
allow_no_forecasts: true
147+
- match: { acknowledged: true }

0 commit comments

Comments
 (0)