Skip to content

Commit

Permalink
[Uptime] Console errors in case index missing (elastic#65115)
Browse files Browse the repository at this point in the history
  • Loading branch information
shahzad31 committed May 5, 2020
1 parent 5dc8610 commit 560c763
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,13 @@ const statusCount = async (context: QueryContext): Promise<Snapshot> => {
body: statusCountBody(await context.dateAndCustomFilters()),
});

return res.aggregations.counts.value;
return (
res.aggregations?.counts?.value ?? {
total: 0,
up: 0,
down: 0,
}
);
};

const statusCountBody = (filters: any): any => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const findPotentialMatches = async (
return {
monitorIds,
checkGroups,
searchAfter: queryResult.aggregations.monitors.after_key,
searchAfter: queryResult.aggregations?.monitors?.after_key,
};
};

Expand Down

0 comments on commit 560c763

Please sign in to comment.