[ML] Fixing results service space checks (#124707)

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
James Gowdy 2022-02-07 15:26:33 +00:00 committed by GitHub
parent 7c7d1cf527
commit afb458ede7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 10 deletions

View file

@ -34,7 +34,7 @@ export function topCategoriesProvider(mlClient: MlClient) {
},
},
},
[]
[jobId]
);
return typeof body.hits.total === 'number' ? body.hits.total : body.hits.total!.value;
}
@ -75,7 +75,7 @@ export function topCategoriesProvider(mlClient: MlClient) {
},
},
},
[]
[jobId]
);
const catCounts: Array<{
@ -123,7 +123,7 @@ export function topCategoriesProvider(mlClient: MlClient) {
},
},
},
[]
[jobId]
);
// @ts-expect-error incorrect search response type

View file

@ -214,7 +214,7 @@ export function resultsServiceProvider(mlClient: MlClient, client?: IScopedClust
sort: [{ record_score: { order: 'desc' } }],
},
},
[]
jobIds
);
const tableData: {
@ -345,7 +345,7 @@ export function resultsServiceProvider(mlClient: MlClient, client?: IScopedClust
},
};
const { body } = await mlClient.anomalySearch(query, []);
const { body } = await mlClient.anomalySearch(query, jobIds);
const maxScore = get(body, ['aggregations', 'max_score', 'value'], null);
return { maxScore };
@ -409,7 +409,7 @@ export function resultsServiceProvider(mlClient: MlClient, client?: IScopedClust
},
},
},
[]
jobIds
);
const bucketsByJobId: Array<{ key: string; maxTimestamp: { value?: number } }> = get(
@ -440,7 +440,7 @@ export function resultsServiceProvider(mlClient: MlClient, client?: IScopedClust
},
},
},
[]
[jobId]
);
const examplesByCategoryId: { [key: string]: any } = {};
@ -477,7 +477,7 @@ export function resultsServiceProvider(mlClient: MlClient, client?: IScopedClust
},
},
},
[]
[jobId]
);
const definition = { categoryId, terms: null, regex: null, examples: [] };
@ -526,7 +526,7 @@ export function resultsServiceProvider(mlClient: MlClient, client?: IScopedClust
},
},
},
[]
[jobId]
);
return body ? body.hits.hits.map((r) => r._source) : [];
}
@ -617,7 +617,7 @@ export function resultsServiceProvider(mlClient: MlClient, client?: IScopedClust
aggs,
},
},
[]
jobIds
);
if (fieldToBucket === JOB_ID) {
finalResults = {