Add scheduled events to the calendar Generally available; Added in 6.2.0

POST /_ml/calendars/{calendar_id}/events

##Required authorization

  • Cluster privileges: manage_ml

Path parameters

  • calendar_id string Required

    A string that uniquely identifies a calendar.

application/json

Body Required

  • events array[object] Required

    A list of one of more scheduled events. The event’s start and end times can be specified as integer milliseconds since the epoch or as a string in ISO 8601 format.

    Hide events attributes Show events attributes object
    • calendar_id string
    • event_id string
    • description string Required

      A description of the scheduled event.

    • end_time string | number Required

      A date and time, either as a string whose format can depend on the context (defaulting to ISO 8601), or a number of milliseconds since the Epoch. Elasticsearch accepts both as input, but will generally output a string representation.

      One of:

      Time unit for milliseconds

    • start_time string | number Required

      A date and time, either as a string whose format can depend on the context (defaulting to ISO 8601), or a number of milliseconds since the Epoch. Elasticsearch accepts both as input, but will generally output a string representation.

      One of:

      Time unit for milliseconds

    • skip_result boolean

      When true the model will not create results for this calendar period.

    • skip_model_update boolean

      When true the model will not be updated for this calendar period.

    • force_time_shift number

      Shift time by this many seconds. For example adjust time for daylight savings changes

Responses

  • 200 application/json
    Hide response attribute Show response attribute object
    • events array[object] Required
      Hide events attributes Show events attributes object
      • calendar_id string
      • event_id string
      • description string Required

        A description of the scheduled event.

      • end_time string | number Required

        A date and time, either as a string whose format can depend on the context (defaulting to ISO 8601), or a number of milliseconds since the Epoch. Elasticsearch accepts both as input, but will generally output a string representation.

        One of:

        Time unit for milliseconds

      • start_time string | number Required

        A date and time, either as a string whose format can depend on the context (defaulting to ISO 8601), or a number of milliseconds since the Epoch. Elasticsearch accepts both as input, but will generally output a string representation.

        One of:

        Time unit for milliseconds

      • skip_result boolean

        When true the model will not create results for this calendar period.

      • skip_model_update boolean

        When true the model will not be updated for this calendar period.

      • force_time_shift number

        Shift time by this many seconds. For example adjust time for daylight savings changes

POST /_ml/calendars/{calendar_id}/events
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}
  ]
}
curl \
 --request POST 'http://api.example.com/_ml/calendars/{calendar_id}/events' \
 --header "Content-Type: application/json" \
 --data '"{\n  \"events\" : [\n    {\"description\": \"event 1\", \"start_time\": 1513641600000, \"end_time\": 1513728000000},\n    {\"description\": \"event 2\", \"start_time\": 1513814400000, \"end_time\": 1513900800000},\n    {\"description\": \"event 3\", \"start_time\": 1514160000000, \"end_time\": 1514246400000}\n  ]\n}"'
Request example
An example body for a `POST _ml/calendars/planned-outages/events` request.
{
  "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}
  ]
}

Documentation preview

This is a preview of your version @2025-06-09 which is not yet released.