浏览代码

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

Increase the maximum duration to ~10 years (3650 days).
Przemysław Witek 6 年之前
父节点
当前提交
891844f0ef

+ 2 - 2
x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/ForecastJobAction.java

@@ -48,8 +48,8 @@ public class ForecastJobAction extends Action<ForecastJobAction.Response> {
         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<Request, Void> PARSER = new ObjectParser<>(NAME, Request::new);
 

+ 8 - 0
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: