原英文版地址: https://www.elastic.co/guide/en/elasticsearch/reference/7.7/ml-post-calendar-event.html, 原文档版权归 www.elastic.co 所有
本地英文版地址: ../en/ml-post-calendar-event.html
本地英文版地址: ../en/ml-post-calendar-event.html
重要: 此版本不会发布额外的bug修复或文档更新。最新信息请参考 当前版本文档。
Add events to calendar APIedit
Posts scheduled events in a calendar.
Requestedit
POST _ml/calendars/<calendar_id>/events
Prerequisitesedit
-
If the Elasticsearch security features are enabled, you must have
manage_ml
ormanage
cluster privileges to use this API. See Security privileges.
Descriptionedit
This API accepts a list of scheduled events, each of which must have a start time, end time, and description.
Path parametersedit
-
<calendar_id>
- (Required, string) A string that uniquely identifies a calendar.
Request bodyedit
-
events
-
(Required, array) A list of one of more scheduled events. The event’s start and end times may be specified as integer milliseconds since the epoch or as a string in ISO 8601 format.
Properties of events
-
description
- (Optional, string) A description of the scheduled event.
-
end_time
- (Required, date) The timestamp for the end of the scheduled event in milliseconds since the epoch or ISO 8601 format.
-
start_time
- (Required, date) The timestamp for the beginning of the scheduled event in milliseconds since the epoch or ISO 8601 format.
-
Examplesedit
POST _ml/calendars/planned-outages/events { "events" : [ {"description": "event 1", "start_time": 1513641600000, "end_time": 1513728000000}, {"description": "event 2", "start_time": 1513814400000, "end_time": 1513900800000}, {"description": "event 3", "start_time": 1514160000000, "end_time": 1514246400000} ] }
The API returns the following results:
{ "events": [ { "description": "event 1", "start_time": 1513641600000, "end_time": 1513728000000, "calendar_id": "planned-outages" }, { "description": "event 2", "start_time": 1513814400000, "end_time": 1513900800000, "calendar_id": "planned-outages" }, { "description": "event 3", "start_time": 1514160000000, "end_time": 1514246400000, "calendar_id": "planned-outages" } ] }