diff --git a/x-pack/legacy/plugins/ml/public/overview/components/anomaly_detection_panel/anomaly_detection_panel.tsx b/x-pack/legacy/plugins/ml/public/overview/components/anomaly_detection_panel/anomaly_detection_panel.tsx index 3517c86a6109f..90b5be2c25406 100644 --- a/x-pack/legacy/plugins/ml/public/overview/components/anomaly_detection_panel/anomaly_detection_panel.tsx +++ b/x-pack/legacy/plugins/ml/public/overview/components/anomaly_detection_panel/anomaly_detection_panel.tsx @@ -98,13 +98,13 @@ export const AnomalyDetectionPanel: FC = () => { return ml.results.getMaxAnomalyScore(group.jobIds, twentyFourHoursAgo, latestTimestamp); }); - const results = await Promise.all(promises.map(p => p.catch(() => undefined))); + const results = await Promise.all(promises); const tempGroups = { ...groupsObject }; // Check results for each group's promise index and update state Object.keys(scores).forEach(groupId => { const resultsIndex = scores[groupId] && scores[groupId].index; - scores[groupId] = resultsIndex !== undefined && results[resultsIndex]; - tempGroups[groupId].max_anomaly_score = resultsIndex !== undefined && results[resultsIndex]; + const { maxScore } = resultsIndex !== undefined && results[resultsIndex]; + tempGroups[groupId].max_anomaly_score = maxScore || undefined; }); setGroups(tempGroups); diff --git a/x-pack/legacy/plugins/ml/server/models/results_service/results_service.js b/x-pack/legacy/plugins/ml/server/models/results_service/results_service.js index 3fd20308b2f9b..9501389af195d 100644 --- a/x-pack/legacy/plugins/ml/server/models/results_service/results_service.js +++ b/x-pack/legacy/plugins/ml/server/models/results_service/results_service.js @@ -264,7 +264,7 @@ export function resultsServiceProvider(callWithRequest) { const resp = await callWithRequest('search', query); const maxScore = _.get(resp, ['aggregations', 'max_score', 'value'], null); - return maxScore; + return { maxScore }; } // Obtains the latest bucket result timestamp by job ID.