Increase maximum forecast interval to 10 years. (#41082) (#42710)

Increase the maximum duration to ~10 years (3650 days).
This commit is contained in:
Przemysław Witek 2019-05-31 06:19:47 +02:00 committed by GitHub
parent 5f9382acc2
commit f6779de2b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View File

@ -48,8 +48,8 @@ public class ForecastJobAction extends Action<ForecastJobAction.Response> {
public static final ParseField DURATION = new ParseField("duration"); public static final ParseField DURATION = new ParseField("duration");
public static final ParseField EXPIRES_IN = new ParseField("expires_in"); public static final ParseField EXPIRES_IN = new ParseField("expires_in");
// Max allowed duration: 8 weeks // Max allowed duration: 10 years
private static final TimeValue MAX_DURATION = TimeValue.parseTimeValue("56d", ""); private static final TimeValue MAX_DURATION = TimeValue.parseTimeValue("3650d", "");
private static final ObjectParser<Request, Void> PARSER = new ObjectParser<>(NAME, Request::new); private static final ObjectParser<Request, Void> PARSER = new ObjectParser<>(NAME, Request::new);

View File

@ -47,6 +47,14 @@ setup:
job_id: "forecast-job" job_id: "forecast-job"
duration: "-1s" 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": "Test forecast given expires_in is negative":
- do: - do: