原英文版地址: https://www.elastic.co/guide/en/elasticsearch/reference/7.7/ml-get-calendar-event.html, 原文档版权归 www.elastic.co 所有
本地英文版地址: ../en/ml-get-calendar-event.html

Get scheduled events APIedit

Retrieves information about the scheduled events in calendars.

Requestedit

GET _ml/calendars/<calendar_id>/events

GET _ml/calendars/_all/events

Prerequisitesedit

  • If the Elasticsearch security features are enabled, you must have monitor_ml, monitor, manage_ml, or manage cluster privileges to use this API. See Security privileges.

Descriptionedit

You can get scheduled event information for a single calendar or for all calendars by using _all.

For more information, see Calendars and scheduled events.

Path parametersedit

<calendar_id>
(Required, string) A string that uniquely identifies a calendar.

Request bodyedit

end
(Optional, string) Specifies to get events with timestamps earlier than this time.
from
(Optional, integer) Skips the specified number of events.
size
(Optional, integer) Specifies the maximum number of events to obtain.
start
(Optional, string) Specifies to get events with timestamps after this time.

Response bodyedit

The API returns an array of scheduled event resources, which have the following properties:

calendar_id
(string) A string that uniquely identifies a calendar.
description
(string) A description of the scheduled event.
end_time
(date) The timestamp for the end of the scheduled event in milliseconds since the epoch or ISO 8601 format.
event_id
(string) An automatically-generated identifier for the scheduled event.
start_time
(date) The timestamp for the beginning of the scheduled event in milliseconds since the epoch or ISO 8601 format.

Examplesedit

GET _ml/calendars/planned-outages/events

The API returns the following results:

{
  "count": 3,
  "events": [
    {
      "description": "event 1",
      "start_time": 1513641600000,
      "end_time": 1513728000000,
      "calendar_id": "planned-outages",
      "event_id": "LS8LJGEBMTCMA-qz49st"
    },
    {
      "description": "event 2",
      "start_time": 1513814400000,
      "end_time": 1513900800000,
      "calendar_id": "planned-outages",
      "event_id": "Li8LJGEBMTCMA-qz49st"
    },
    {
      "description": "event 3",
      "start_time": 1514160000000,
      "end_time": 1514246400000,
      "calendar_id": "planned-outages",
      "event_id": "Ly8LJGEBMTCMA-qz49st"
    }
  ]
}