diff --git a/src/Nest/XPack/MachineLearning/Job/Config/Job.cs b/src/Nest/XPack/MachineLearning/Job/Config/Job.cs
index 68d6ee662ab..2fa1829db07 100644
--- a/src/Nest/XPack/MachineLearning/Job/Config/Job.cs
+++ b/src/Nest/XPack/MachineLearning/Job/Config/Job.cs
@@ -90,11 +90,27 @@ public class Job
///
/// The time in days that model snapshots are retained for the job.
- /// Older snapshots are deleted. The default value is 1 day.
+ /// Older snapshots are deleted. The default value is 10 days in Elasticsearch 7.8.0+
+ /// and 1 day in older versions.
///
[DataMember(Name = "model_snapshot_retention_days")]
public long? ModelSnapshotRetentionDays { get; set; }
+ ///
+ /// Specifies a number of days between 0 and the value of .
+ /// After this period of time, only the first model snapshot per day is retained for this job.
+ /// Age is calculated relative to the timestamp of the newest model snapshot. For new jobs, the default
+ /// value is 1, which means that all snapshots are retained for one day. Older snapshots
+ /// are thinned out such that only one per day is retained. For jobs that were
+ /// created before this setting was available, the default value matches the
+ /// value, which preserves the original behavior
+ /// and no thinning out of model snapshots occurs.
+ ///
+ /// Available in Elasticsearch 7.8.0+
+ ///
+ [DataMember(Name = "daily_model_snapshot_retention_after_days")]
+ public long? DailyModelSnapshotRetentionAfterDays { get; set; }
+
///
/// Advanced configuration option. The period over which adjustments to the score are applied, as new data
/// is seen. The default value is the longer of 30 days or 100 bucket spans.
diff --git a/src/Nest/XPack/MachineLearning/MachineLearningInfo/MachineLearningInfoResponse.cs b/src/Nest/XPack/MachineLearning/MachineLearningInfo/MachineLearningInfoResponse.cs
index 18eb3680eb6..5d28bf9941b 100644
--- a/src/Nest/XPack/MachineLearning/MachineLearningInfo/MachineLearningInfoResponse.cs
+++ b/src/Nest/XPack/MachineLearning/MachineLearningInfo/MachineLearningInfoResponse.cs
@@ -39,6 +39,12 @@ public class AnomalyDetectors
[DataMember(Name = "model_snapshot_retention_days")]
public int ModelSnapshotRetentionDays { get; internal set; }
+ ///
+ /// Available in Elasticsearch 7.8.0+
+ ///
+ [DataMember(Name = "daily_model_snapshot_retention_after_days")]
+ public long DailyModelSnapshotRetentionAfterDays { get; internal set; }
+
[DataMember(Name = "categorization_analyzer")]
public CategorizationAnalyzer CategorizationAnalyzer { get; internal set; }
}
diff --git a/src/Nest/XPack/MachineLearning/PutJob/PutJobRequest.cs b/src/Nest/XPack/MachineLearning/PutJob/PutJobRequest.cs
index ec9079a4501..749ade0b85f 100644
--- a/src/Nest/XPack/MachineLearning/PutJob/PutJobRequest.cs
+++ b/src/Nest/XPack/MachineLearning/PutJob/PutJobRequest.cs
@@ -48,11 +48,27 @@ public partial interface IPutJobRequest
///
/// The time in days that model snapshots are retained for the job.
- /// Older snapshots are deleted. The default value is 1 day.
+ /// Older snapshots are deleted. The default value is 10 days in Elasticsearch 7.8.0+
+ /// and 1 day in older versions.
///
[DataMember(Name ="model_snapshot_retention_days")]
long? ModelSnapshotRetentionDays { get; set; }
+ ///
+ /// Specifies a number of days between 0 and the value of .
+ /// After this period of time, only the first model snapshot per day is retained for this job.
+ /// Age is calculated relative to the timestamp of the newest model snapshot. For new jobs, the default
+ /// value is 1, which means that all snapshots are retained for one day. Older snapshots
+ /// are thinned out such that only one per day is retained. For jobs that were
+ /// created before this setting was available, the default value matches the
+ /// value, which preserves the original behavior
+ /// and no thinning out of model snapshots occurs.
+ ///
+ /// Available in Elasticsearch 7.8.0+
+ ///
+ [DataMember(Name ="daily_model_snapshot_retention_after_days")]
+ long? DailyModelSnapshotRetentionAfterDays { get; set; }
+
///
/// The name of the index in which to store the machine learning results.
/// The default value is shared, which corresponds to the index name .ml-anomalies-shared.
@@ -93,6 +109,9 @@ public partial class PutJobRequest
///
public long? ModelSnapshotRetentionDays { get; set; }
+ ///
+ public long? DailyModelSnapshotRetentionAfterDays { get; set; }
+
///
public IndexName ResultsIndexName { get; set; }
@@ -109,41 +128,46 @@ public partial class PutJobDescriptor where TDocument : class
string IPutJobRequest.Description { get; set; }
IModelPlotConfig IPutJobRequest.ModelPlotConfig { get; set; }
long? IPutJobRequest.ModelSnapshotRetentionDays { get; set; }
+ long? IPutJobRequest.DailyModelSnapshotRetentionAfterDays { get; set; }
IndexName IPutJobRequest.ResultsIndexName { get; set; }
bool? IPutJobRequest.AllowLazyOpen { get; set; }
- ///
+ ///
public PutJobDescriptor AnalysisConfig(Func, IAnalysisConfig> selector) =>
Assign(selector, (a, v) => a.AnalysisConfig = v?.Invoke(new AnalysisConfigDescriptor()));
- ///
+ ///
public PutJobDescriptor AnalysisLimits(Func selector) =>
Assign(selector, (a, v) => a.AnalysisLimits = v?.Invoke(new AnalysisLimitsDescriptor()));
- ///
+ ///
public PutJobDescriptor DataDescription(Func, IDataDescription> selector) =>
Assign(selector.InvokeOrDefault(new DataDescriptionDescriptor()), (a, v) => a.DataDescription = v);
- ///
+ ///
public PutJobDescriptor Description(string description) => Assign(description, (a, v) => a.Description = v);
- ///
+ ///
public PutJobDescriptor ModelPlot(Func, IModelPlotConfig> selector) =>
Assign(selector, (a, v) => a.ModelPlotConfig = v?.Invoke(new ModelPlotConfigDescriptor()));
- ///
+ ///
public PutJobDescriptor ModelSnapshotRetentionDays(long? modelSnapshotRetentionDays) =>
Assign(modelSnapshotRetentionDays, (a, v) => a.ModelSnapshotRetentionDays = v);
- ///
+ ///
+ public PutJobDescriptor DailyModelSnapshotRetentionAfterDays(long? dailyModelSnapshotRetentionAfterDays) =>
+ Assign(dailyModelSnapshotRetentionAfterDays, (a, v) => a.DailyModelSnapshotRetentionAfterDays = v);
+
+ ///
public PutJobDescriptor ResultsIndexName(IndexName indexName) =>
Assign(indexName, (a, v) => a.ResultsIndexName = v);
- ///
+ ///
public PutJobDescriptor ResultsIndexName() =>
Assign(typeof(TIndex), (a, v) => a.ResultsIndexName = v);
- ///
+ ///
public PutJobDescriptor AllowLazyOpen(bool? allowLazyOpen = true) =>
Assign(allowLazyOpen, (a, v) => a.AllowLazyOpen = v);
}
diff --git a/src/Nest/XPack/MachineLearning/UpdateJob/UpdateJobRequest.cs b/src/Nest/XPack/MachineLearning/UpdateJob/UpdateJobRequest.cs
index 27b847606d7..e9a05c74e1f 100644
--- a/src/Nest/XPack/MachineLearning/UpdateJob/UpdateJobRequest.cs
+++ b/src/Nest/XPack/MachineLearning/UpdateJob/UpdateJobRequest.cs
@@ -52,11 +52,27 @@ public partial interface IUpdateJobRequest
///
/// The time in days that model snapshots are retained for the job.
- /// Older snapshots are deleted. The default value is 1 day.
+ /// Older snapshots are deleted. The default value is 10 days in Elasticsearch 7.8.0+
+ /// and 1 day in older versions.
///
[DataMember(Name ="model_snapshot_retention_days")]
long? ModelSnapshotRetentionDays { get; set; }
+ ///
+ /// Specifies a number of days between 0 and the value of .
+ /// After this period of time, only the first model snapshot per day is retained for this job.
+ /// Age is calculated relative to the timestamp of the newest model snapshot. For new jobs, the default
+ /// value is 1, which means that all snapshots are retained for one day. Older snapshots
+ /// are thinned out such that only one per day is retained. For jobs that were
+ /// created before this setting was available, the default value matches the
+ /// value, which preserves the original behavior
+ /// and no thinning out of model snapshots occurs.
+ ///
+ /// Available in Elasticsearch 7.8.0+
+ ///
+ [DataMember(Name ="daily_model_snapshot_retention_after_days")]
+ long? DailyModelSnapshotRetentionAfterDays { get; set; }
+
///
/// The period over which adjustments to the score are applied, as new data is seen.
///
@@ -104,6 +120,9 @@ public partial class UpdateJobRequest
///
public long? ModelSnapshotRetentionDays { get; set; }
+ ///
+ public long? DailyModelSnapshotRetentionAfterDays { get; set; }
+
///
public long? RenormalizationWindowDays { get; set; }
@@ -123,43 +142,47 @@ public partial class UpdateJobDescriptor where TDocument : class
string IUpdateJobRequest.Description { get; set; }
IModelPlotConfigEnabled IUpdateJobRequest.ModelPlotConfig { get; set; }
long? IUpdateJobRequest.ModelSnapshotRetentionDays { get; set; }
+ long? IUpdateJobRequest.DailyModelSnapshotRetentionAfterDays { get; set; }
long? IUpdateJobRequest.RenormalizationWindowDays { get; set; }
long? IUpdateJobRequest.ResultsRetentionDays { get; set; }
-
bool? IUpdateJobRequest.AllowLazyOpen { get; set; }
- ///
+ ///
public UpdateJobDescriptor AnalysisLimits(Func selector) =>
Assign(selector, (a, v) => a.AnalysisLimits = v?.Invoke(new AnalysisMemoryLimitDescriptor()));
- ///
+ ///
public UpdateJobDescriptor BackgroundPersistInterval(Time backgroundPersistInterval) =>
Assign(backgroundPersistInterval, (a, v) => a.BackgroundPersistInterval = v);
- ///
+ ///
public UpdateJobDescriptor CustomSettings(Func, FluentDictionary> customSettingsDictionary
) =>
Assign(customSettingsDictionary(new FluentDictionary()), (a, v) => a.CustomSettings = v);
- ///
+ ///
public UpdateJobDescriptor Description(string description) => Assign(description, (a, v) => a.Description = v);
- ///
+ ///
public UpdateJobDescriptor ModelPlot(Func, IModelPlotConfigEnabled> selector) =>
Assign(selector, (a, v) => a.ModelPlotConfig = v?.Invoke(new ModelPlotConfigEnabledDescriptor()));
- ///
+ ///
public UpdateJobDescriptor ModelSnapshotRetentionDays(long? modelSnapshotRetentionDays) =>
Assign(modelSnapshotRetentionDays, (a, v) => a.ModelSnapshotRetentionDays = v);
- ///
+ ///
+ public UpdateJobDescriptor DailyModelSnapshotRetentionAfterDays(long? dailyModelSnapshotRetentionAfterDays) =>
+ Assign(dailyModelSnapshotRetentionAfterDays, (a, v) => a.DailyModelSnapshotRetentionAfterDays = v);
+
+ ///
public UpdateJobDescriptor RenormalizationWindowDays(long? renormalizationWindowDays) =>
Assign(renormalizationWindowDays, (a, v) => a.RenormalizationWindowDays = v);
- ///
+ ///
public UpdateJobDescriptor ResultsRetentionDays(long? resultsRetentionDays) => Assign(resultsRetentionDays, (a, v) => a.ResultsRetentionDays = v);
- ///
+ ///
public UpdateJobDescriptor AllowLazyOpen(bool? allowLazyOpen = true) =>
Assign(allowLazyOpen, (a, v) => a.AllowLazyOpen = v);
}
diff --git a/tests/Tests/XPack/MachineLearning/MachineLearningInfo/MachineLearningInfoApiTests.cs b/tests/Tests/XPack/MachineLearning/MachineLearningInfo/MachineLearningInfoApiTests.cs
index 39dff6117b2..c87c7de5486 100644
--- a/tests/Tests/XPack/MachineLearning/MachineLearningInfo/MachineLearningInfoApiTests.cs
+++ b/tests/Tests/XPack/MachineLearning/MachineLearningInfo/MachineLearningInfoApiTests.cs
@@ -47,6 +47,9 @@ protected override void ExpectResponse(MachineLearningInfoResponse response)
? 10
: 1);
+ if (TestClient.Configuration.InRange(">=7.8.0"))
+ anomalyDetectors.DailyModelSnapshotRetentionAfterDays.Should().Be(1);
+
response.Defaults.Datafeeds.ScrollSize.Should().Be(1000);
if (Cluster.ClusterConfiguration.Version >= "7.6.0")