Skip to content

Commit

Permalink
[7.x] [Uptime] Console errors in case index missing (elastic#65115) (e…
Browse files Browse the repository at this point in the history
  • Loading branch information
shahzad31 authored May 5, 2020
1 parent 754711a commit c5f486a
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 c5f486a

Please sign in to comment.