Path parameters

  • calendar_idstring Required

    A string that uniquely identifies a calendar.

application/json

BodyRequired

  • eventsarray[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
    • event_idstring
    • descriptionstring Required

      A description of the scheduled event.

    • end_timestring | 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_timestring | 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

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

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

    • 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
    • eventsarray[object] Required
      Hide events attributes Show events attributes object
      • event_idstring
      • descriptionstring Required

        A description of the scheduled event.

      • end_timestring | 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_timestring | 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

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

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

      • 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}
  ]
}
resp = client.ml.post_calendar_events(
    calendar_id="planned-outages",
    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
        }
    ],
)
const response = await client.ml.postCalendarEvents({
  calendar_id: "planned-outages",
  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,
    },
  ],
});
response = client.ml.post_calendar_events(
  calendar_id: "planned-outages",
  body: {
    "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
      }
    ]
  }
)
$resp = $client->ml()->postCalendarEvents([
    "calendar_id" => "planned-outages",
    "body" => [
        "events" => array(
            [
                "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 -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d '{"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}]}' "$ELASTICSEARCH_URL/_ml/calendars/planned-outages/events"
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}
  ]
}