Skip to content

Commit 873bd31

Browse files
committed
[ML] Add _cat/ml/anomaly_detectors API (elastic#51364)
* [ML] Add _cat/ml/anomaly_detectors/_stats * addressing PR feedback
1 parent d3078c5 commit 873bd31

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
@@ -252,6 +252,7 @@
252252
import org.elasticsearch.xpack.ml.rest.calendar.RestPostCalendarEventAction;
253253
import org.elasticsearch.xpack.ml.rest.calendar.RestPutCalendarAction;
254254
import org.elasticsearch.xpack.ml.rest.calendar.RestPutCalendarJobAction;
255+
import org.elasticsearch.xpack.ml.rest.cat.RestCatJobsAction;
255256
import org.elasticsearch.xpack.ml.rest.datafeeds.RestDeleteDatafeedAction;
256257
import org.elasticsearch.xpack.ml.rest.datafeeds.RestGetDatafeedStatsAction;
257258
import org.elasticsearch.xpack.ml.rest.datafeeds.RestGetDatafeedsAction;
@@ -777,7 +778,9 @@ public List<RestHandler> getRestHandlers(Settings settings, RestController restC
777778
new RestGetTrainedModelsAction(restController),
778779
new RestDeleteTrainedModelAction(restController),
779780
new RestGetTrainedModelsStatsAction(restController),
780-
new RestPutTrainedModelAction(restController)
781+
new RestPutTrainedModelAction(restController),
782+
// CAT Handlers
783+
new RestCatJobsAction(restController)
781784
);
782785
}
783786

0 commit comments

Comments
 (0)