Skip to content

Commit ac4482a

Browse files
[ML] Fixing overview page max anomaly score (#48110) (#48368)
* [ML] Fixing overview page max anomaly score * removing unnecessary copy of maxScore
1 parent ba0db38 commit ac4482a

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

x-pack/legacy/plugins/ml/public/overview/components/anomaly_detection_panel/anomaly_detection_panel.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,13 @@ export const AnomalyDetectionPanel: FC = () => {
9898
return ml.results.getMaxAnomalyScore(group.jobIds, twentyFourHoursAgo, latestTimestamp);
9999
});
100100

101-
const results = await Promise.all(promises.map(p => p.catch(() => undefined)));
101+
const results = await Promise.all(promises);
102102
const tempGroups = { ...groupsObject };
103103
// Check results for each group's promise index and update state
104104
Object.keys(scores).forEach(groupId => {
105105
const resultsIndex = scores[groupId] && scores[groupId].index;
106-
scores[groupId] = resultsIndex !== undefined && results[resultsIndex];
107-
tempGroups[groupId].max_anomaly_score = resultsIndex !== undefined && results[resultsIndex];
106+
const { maxScore } = resultsIndex !== undefined && results[resultsIndex];
107+
tempGroups[groupId].max_anomaly_score = maxScore || undefined;
108108
});
109109

110110
setGroups(tempGroups);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ export function resultsServiceProvider(callWithRequest) {
264264
const resp = await callWithRequest('search', query);
265265
const maxScore = _.get(resp, ['aggregations', 'max_score', 'value'], null);
266266

267-
return maxScore;
267+
return { maxScore };
268268
}
269269

270270
// Obtains the latest bucket result timestamp by job ID.

0 commit comments

Comments
 (0)