From 659a49de60bce3ecf1e67678e3f8892543ac860e Mon Sep 17 00:00:00 2001 From: James Gowdy Date: Tue, 4 Sep 2018 07:12:23 +0100 Subject: [PATCH] [ML] Fixing issue with historical job audit messages (#21718) (#22630) --- .../ml/server/models/job_audit_messages/job_audit_messages.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/ml/server/models/job_audit_messages/job_audit_messages.js b/x-pack/plugins/ml/server/models/job_audit_messages/job_audit_messages.js index 0b0524acd58bf..3a6a61474f8dd 100644 --- a/x-pack/plugins/ml/server/models/job_audit_messages/job_audit_messages.js +++ b/x-pack/plugins/ml/server/models/job_audit_messages/job_audit_messages.js @@ -20,8 +20,8 @@ export function jobAuditMessagesProvider(callWithRequest) { let gte = null; if (jobId !== undefined && from === undefined) { const jobs = await callWithRequest('ml.jobs', { jobId }); - if (jobs.length) { - gte = moment(jobs[0].create_time).valueOf(); + if (jobs.count > 0 && jobs.jobs !== undefined) { + gte = moment(jobs.jobs[0].create_time).valueOf(); } } else if (from !== undefined) { gte = `now-${from}`;