diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/ForecastJobAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/ForecastJobAction.java index 0ea66ad0937..fb107579c6e 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/ForecastJobAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/ForecastJobAction.java @@ -48,8 +48,8 @@ public class ForecastJobAction extends Action { public static final ParseField DURATION = new ParseField("duration"); public static final ParseField EXPIRES_IN = new ParseField("expires_in"); - // Max allowed duration: 8 weeks - private static final TimeValue MAX_DURATION = TimeValue.parseTimeValue("56d", ""); + // Max allowed duration: 10 years + private static final TimeValue MAX_DURATION = TimeValue.parseTimeValue("3650d", ""); private static final ObjectParser PARSER = new ObjectParser<>(NAME, Request::new); diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/forecast.yml b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/forecast.yml index 998f70de9d3..a81b6dba08e 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/forecast.yml +++ b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/forecast.yml @@ -47,6 +47,14 @@ setup: job_id: "forecast-job" duration: "-1s" +--- +"Test forecast given duration is too large": + - do: + catch: /\[duration\] must be 3650d or less[:] \[3651d\]/ + ml.forecast: + job_id: "forecast-job" + duration: "3651d" + --- "Test forecast given expires_in is negative": - do: