Skip to content

Commit a25f922

Browse files
authored
[ML] Add _cat/ml/anomaly_detectors API (#51364)
* [ML] Add _cat/ml/anomaly_detectors/_stats * addressing PR feedback
1 parent 520da54 commit a25f922

File tree

6 files changed

+745
-1
lines changed

6 files changed

+745
-1
lines changed

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/stats/ForecastStats.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,30 @@ public ForecastStats merge(ForecastStats other) {
8383
return this;
8484
}
8585

86+
public long getTotal() {
87+
return total;
88+
}
89+
90+
public long getForecastedJobs() {
91+
return forecastedJobs;
92+
}
93+
94+
public StatsAccumulator getMemoryStats() {
95+
return memoryStats;
96+
}
97+
98+
public StatsAccumulator getRecordStats() {
99+
return recordStats;
100+
}
101+
102+
public StatsAccumulator getRuntimeStats() {
103+
return runtimeStats;
104+
}
105+
106+
public CountAccumulator getStatusCounts() {
107+
return statusCounts;
108+
}
109+
86110
@Override
87111
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
88112
builder.startObject();

x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/MachineLearning.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@
255255
import org.elasticsearch.xpack.ml.rest.calendar.RestPostCalendarEventAction;
256256
import org.elasticsearch.xpack.ml.rest.calendar.RestPutCalendarAction;
257257
import org.elasticsearch.xpack.ml.rest.calendar.RestPutCalendarJobAction;
258+
import org.elasticsearch.xpack.ml.rest.cat.RestCatJobsAction;
258259
import org.elasticsearch.xpack.ml.rest.datafeeds.RestDeleteDatafeedAction;
259260
import org.elasticsearch.xpack.ml.rest.datafeeds.RestGetDatafeedStatsAction;
260261
import org.elasticsearch.xpack.ml.rest.datafeeds.RestGetDatafeedsAction;
@@ -765,7 +766,9 @@ public List<RestHandler> getRestHandlers(Settings settings, RestController restC
765766
new RestGetTrainedModelsAction(restController),
766767
new RestDeleteTrainedModelAction(restController),
767768
new RestGetTrainedModelsStatsAction(restController),
768-
new RestPutTrainedModelAction(restController)
769+
new RestPutTrainedModelAction(restController),
770+
// CAT Handlers
771+
new RestCatJobsAction(restController)
769772
);
770773
}
771774

0 commit comments

Comments
 (0)