Skip to content

Commit bfffb34

Browse files
henriquegoncalves98droberts195
authored andcommitted
[ML] Make GetJobStats work with arbitrary wildcards and groups (#36683)
The /_ml/anomaly_detectors/{job}/_stats endpoint now works correctly when {job} is a wildcard or job group. Closes #34745
1 parent 797462b commit bfffb34

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/GetJobsStatsAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public boolean allowNoJobs() {
118118

119119
@Override
120120
public boolean match(Task task) {
121-
return OpenJobAction.JobTaskMatcher.match(task, jobId);
121+
return expandedJobsIds.stream().anyMatch(jobId -> OpenJobAction.JobTaskMatcher.match(task, jobId));
122122
}
123123

124124
@Override

x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/action/TransportGetJobsStatsActionTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public void testDetermineJobIds() {
3939

4040
result = determineJobIdsWithoutLiveStats(Arrays.asList("id1", "id2", "id3"),
4141
Collections.singletonList(new GetJobsStatsAction.Response.JobStats("id1", new DataCounts("id1"), null, null,
42-
JobState.CLOSED, null, null, null))
42+
JobState.OPENED, null, null, null))
4343
);
4444
assertEquals(2, result.size());
4545
assertEquals("id2", result.get(0));

0 commit comments

Comments
 (0)