Skip to content

Commit

Permalink
[Enterprise Search] Fix connector overview stats
Browse files Browse the repository at this point in the history
  • Loading branch information
sphilipse committed Nov 21, 2022
1 parent 98b171d commit 274f5ee
Showing 1 changed file with 25 additions and 6 deletions.
31 changes: 25 additions & 6 deletions x-pack/plugins/enterprise_search/server/lib/stats/get_sync_jobs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,14 @@ export const fetchSyncJobsStats = async (client: IScopedClusterClient): Promise<
const orphanedJobsCountResponse = await client.asCurrentUser.count({
index: CONNECTORS_JOBS_INDEX,
query: {
terms: {
'connector.id': ids,
bool: {
must_not: [
{
terms: {
'connector.id': ids,
},
},
],
},
},
});
Expand All @@ -51,7 +57,7 @@ export const fetchSyncJobsStats = async (client: IScopedClusterClient): Promise<
},
{
range: {
last_seen: {
started_at: {
lt: moment().subtract(1, 'day').toISOString(),
},
},
Expand All @@ -64,8 +70,21 @@ export const fetchSyncJobsStats = async (client: IScopedClusterClient): Promise<
const errorResponse = await client.asCurrentUser.count({
index: CONNECTORS_JOBS_INDEX,
query: {
term: {
status: SyncStatus.ERROR,
bool: {
should: [
{
term: {
status: SyncStatus.ERROR,
},
},
{
range: {
last_seen: {
lt: moment().subtract(30, 'minutes').toISOString(),
},
},
},
],
},
},
});
Expand Down Expand Up @@ -109,7 +128,7 @@ export const fetchSyncJobsStats = async (client: IScopedClusterClient): Promise<
{
range: {
last_seen: {
gt: moment().subtract(30, 'minutes').toISOString(),
lt: moment().subtract(30, 'minutes').toISOString(),
},
},
},
Expand Down

0 comments on commit 274f5ee

Please sign in to comment.