diff --git a/src/Nest/XPack/Info/XPackUsage/XPackUsageResponse.cs b/src/Nest/XPack/Info/XPackUsage/XPackUsageResponse.cs index d96028a69a1..07d79449a38 100644 --- a/src/Nest/XPack/Info/XPackUsage/XPackUsageResponse.cs +++ b/src/Nest/XPack/Info/XPackUsage/XPackUsageResponse.cs @@ -186,6 +186,9 @@ public class Job [JsonProperty("model_size")] public JobStatistics ModelSize { get; internal set; } + + [JsonProperty("forecasts")] + public ForecastStatistics Forecasts { get; internal set; } } public class JobStatistics @@ -202,5 +205,45 @@ public class JobStatistics [JsonProperty("total")] public double Total { get; internal set; } } + + public class ForecastStatistics + { + /// + /// The number of forecasts currently available for this model. + /// + [JsonProperty("total")] + public long Total { get; internal set; } + + /// + /// The number of jobs that have at least one forecast. + /// + [JsonProperty("forecasted_jobs")] + public long Jobs { get; internal set; } + + /// + /// Statistics about the memory usage: minimum, maximum, average and total. + /// + [JsonProperty("memory_bytes")] + public JobStatistics MemoryBytes { get; internal set; } + + /// + /// Statistics about the forecast runtime in milliseconds: minimum, maximum, average and total. + /// + [JsonProperty("processing_time_ms")] + public JobStatistics ProcessingTimeMilliseconds { get; internal set; } + + /// + /// Statistics about the number of forecast records: minimum, maximum, average and total. + /// + [JsonProperty("records")] + public JobStatistics Records { get; internal set; } + + /// + /// Counts per forecast status. + /// + [JsonProperty("status")] + public IReadOnlyDictionary Status { get; internal set; } + = EmptyReadOnly.Dictionary; + } } } diff --git a/src/Nest/XPack/MachineLearning/Job/Config/JobStats.cs b/src/Nest/XPack/MachineLearning/Job/Config/JobStats.cs index 573d3cfe85f..3ffc34a17ef 100644 --- a/src/Nest/XPack/MachineLearning/Job/Config/JobStats.cs +++ b/src/Nest/XPack/MachineLearning/Job/Config/JobStats.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json; +using System.Collections.Generic; +using Newtonsoft.Json; namespace Nest { @@ -49,5 +50,60 @@ public class JobStats /// [JsonProperty("state")] public JobState State { get; internal set; } + + /// + /// Contains job statistics if job contains a forecast. + /// + [JsonProperty("forecasts_stats")] + public JobForecastStatistics Forecasts { get; internal set; } + } + + public class JobForecastStatistics + { + /// + /// The number of forecasts currently available for this model. + /// + [JsonProperty("total")] + public long Total { get; internal set; } + + /// + /// Statistics about the memory usage: minimum, maximum, average and total. + /// + [JsonProperty("memory_bytes")] + public JobStatistics MemoryBytes { get; internal set; } + + /// + /// Statistics about the forecast runtime in milliseconds: minimum, maximum, average and total. + /// + [JsonProperty("processing_time_ms")] + public JobStatistics ProcessingTimeMilliseconds { get; internal set; } + + /// + /// Statistics about the number of forecast records: minimum, maximum, average and total. + /// + [JsonProperty("records")] + public JobStatistics Records { get; internal set; } + + /// + /// Counts per forecast status. + /// + [JsonProperty("status")] + public IReadOnlyDictionary Status { get; internal set; } + = EmptyReadOnly.Dictionary; + + public class JobStatistics + { + [JsonProperty("avg")] + public double Average { get; internal set; } + + [JsonProperty("max")] + public double Maximum { get; internal set; } + + [JsonProperty("min")] + public double Minimum { get; internal set; } + + [JsonProperty("total")] + public double Total { get; internal set; } + } } }