[ML] Fix audit messages. (#27575)

This commit is contained in:
Walter Rafelsberger 2018-12-21 10:59:52 +01:00 committed by GitHub
parent 973fad3b0a
commit 7971b15cec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View file

@ -103,7 +103,11 @@ export function jobAuditMessagesProvider(callWithRequest) {
}
// search highest, most recent audit messages for all jobs for the last 24hrs.
async function getAuditMessagesSummary() {
async function getAuditMessagesSummary(jobAggregationSize = 10) {
// TODO This is the current default value of the cluster setting `search.max_buckets`.
// This should possibly consider the real settings in a future update.
const maxBuckets = 10000;
try {
const resp = await callWithRequest('search', {
index: ML_NOTIFICATION_INDEX_PATTERN,
@ -126,6 +130,7 @@ export function jobAuditMessagesProvider(callWithRequest) {
levelsPerJob: {
terms: {
field: 'job_id',
size: Math.min(maxBuckets, jobAggregationSize)
},
aggs: {
levels: {

View file

@ -89,7 +89,7 @@ export function jobsProvider(callWithRequest) {
async function jobsSummary(jobIds = []) {
const fullJobsList = await createFullJobsList();
const auditMessages = await getAuditMessagesSummary();
const auditMessages = await getAuditMessagesSummary(fullJobsList.length);
const auditMessagesByJob = auditMessages.reduce((p, c) => {
p[c.job_id] = c;
return p;