Skip to content

Commit ba0670d

Browse files
authored
[Uptime] Console errors in case index missing (#65115)
1 parent 7d15c21 commit ba0670d

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

x-pack/plugins/uptime/server/lib/requests/get_snapshot_counts.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,13 @@ const statusCount = async (context: QueryContext): Promise<Snapshot> => {
5555
body: statusCountBody(await context.dateAndCustomFilters()),
5656
});
5757

58-
return res.aggregations.counts.value;
58+
return (
59+
res.aggregations?.counts?.value ?? {
60+
total: 0,
61+
up: 0,
62+
down: 0,
63+
}
64+
);
5965
};
6066

6167
const statusCountBody = (filters: any): any => {

x-pack/plugins/uptime/server/lib/requests/search/find_potential_matches.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export const findPotentialMatches = async (
4747
return {
4848
monitorIds,
4949
checkGroups,
50-
searchAfter: queryResult.aggregations.monitors.after_key,
50+
searchAfter: queryResult.aggregations?.monitors?.after_key,
5151
};
5252
};
5353

0 commit comments

Comments
 (0)