Path parameters

  • job_idstring Required

    Identifier for the anomaly detection job. The job must be open when you create a forecast; otherwise, an error occurs.

Query parameters

  • durationstring

    A period of time that indicates how far into the future to forecast. For example, 30d corresponds to 30 days. The forecast starts at the last record that was processed.

    Values are -1 or 0.

  • The period of time that forecast results are retained. After a forecast expires, the results are deleted. If set to a value of 0, the forecast is never automatically deleted.

    Values are -1 or 0.

  • The maximum memory the forecast can use. If the forecast needs to use more than the provided amount, it will spool to disk. Default is 20mb, maximum is 500mb and minimum is 1mb. If set to 40% or more of the job’s configured memory limit, it is automatically reduced to below that amount.

application/json

Body

  • durationstring

    A duration. Units can be nanos, micros, ms (milliseconds), s (seconds), m (minutes), h (hours) and d (days). Also accepts "0" without a unit and "-1" to indicate an unspecified value.

  • A duration. Units can be nanos, micros, ms (milliseconds), s (seconds), m (minutes), h (hours) and d (days). Also accepts "0" without a unit and "-1" to indicate an unspecified value.

  • Refer to the description for the max_model_memory query parameter.

Responses

POST /_ml/anomaly_detectors/{job_id}/_forecast
POST _ml/anomaly_detectors/low_request_rate/_forecast
{
  "duration": "10d"
}
resp = client.ml.forecast(
    job_id="low_request_rate",
    duration="10d",
)
const response = await client.ml.forecast({
  job_id: "low_request_rate",
  duration: "10d",
});
response = client.ml.forecast(
  job_id: "low_request_rate",
  body: {
    "duration": "10d"
  }
)
$resp = $client->ml()->forecast([
    "job_id" => "low_request_rate",
    "body" => [
        "duration" => "10d",
    ],
]);
curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d '{"duration":"10d"}' "$ELASTICSEARCH_URL/_ml/anomaly_detectors/low_request_rate/_forecast"
Request example
An example body for a `POST _ml/anomaly_detectors/low_request_rate/_forecast` request.
{
  "duration": "10d"
}