Skip to content

Commit 5994f61

Browse files
Merge branch 'master' into np/searchprofiler/move-out-of-legacy
2 parents 75d1302 + bf0bcfe commit 5994f61

File tree

2 files changed

+26
-198
lines changed

2 files changed

+26
-198
lines changed

x-pack/legacy/plugins/ml/public/application/services/job_messages_service.js

Lines changed: 0 additions & 193 deletions
This file was deleted.

x-pack/legacy/plugins/ml/server/models/job_audit_messages/job_audit_messages.js

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,30 @@ import moment from 'moment';
1010
const SIZE = 1000;
1111
const LEVEL = { system_info: -1, info: 0, warning: 1, error: 2 };
1212

13+
// filter to match job_type: 'anomaly_detector' or no job_type field at all
14+
// if no job_type field exist, we can assume the message is for an anomaly detector job
15+
const anomalyDetectorTypeFilter = {
16+
bool: {
17+
should: [
18+
{
19+
term: {
20+
job_type: 'anomaly_detector',
21+
},
22+
},
23+
{
24+
bool: {
25+
must_not: {
26+
exists: {
27+
field: 'job_type',
28+
},
29+
},
30+
},
31+
},
32+
],
33+
minimum_should_match: 1,
34+
},
35+
};
36+
1337
export function jobAuditMessagesProvider(callWithRequest) {
1438
// search for audit messages,
1539
// jobId is optional. without it, all jobs will be listed.
@@ -47,13 +71,9 @@ export function jobAuditMessagesProvider(callWithRequest) {
4771
level: 'activity',
4872
},
4973
},
50-
must: {
51-
term: {
52-
job_type: 'anomaly_detector',
53-
},
54-
},
5574
},
5675
},
76+
anomalyDetectorTypeFilter,
5777
timeFilter,
5878
],
5979
},
@@ -119,6 +139,7 @@ export function jobAuditMessagesProvider(callWithRequest) {
119139
},
120140
},
121141
},
142+
anomalyDetectorTypeFilter,
122143
],
123144
},
124145
};

0 commit comments

Comments
 (0)