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

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit afb458ede7)

Co-authored-by: James Gowdy <jgowdy@elastic.co>
This commit is contained in:
Kibana Machine 2022-02-11 04:59:17 -05:00 committed by GitHub
parent 8de9d603a1
commit b23900728c
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

@ -180,7 +180,7 @@ export function resultsServiceProvider(mlClient: MlClient, client?: IScopedClust
sort: [{ record_score: { order: 'desc' } }],
},
},
[]
jobIds
);
const tableData: {
@ -311,7 +311,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 };
@ -375,7 +375,7 @@ export function resultsServiceProvider(mlClient: MlClient, client?: IScopedClust
},
},
},
[]
jobIds
);
const bucketsByJobId: Array<{ key: string; maxTimestamp: { value?: number } }> = get(
@ -406,7 +406,7 @@ export function resultsServiceProvider(mlClient: MlClient, client?: IScopedClust
},
},
},
[]
[jobId]
);
const examplesByCategoryId: { [key: string]: any } = {};
@ -443,7 +443,7 @@ export function resultsServiceProvider(mlClient: MlClient, client?: IScopedClust
},
},
},
[]
[jobId]
);
const definition = { categoryId, terms: null, regex: null, examples: [] };
@ -492,7 +492,7 @@ export function resultsServiceProvider(mlClient: MlClient, client?: IScopedClust
},
},
},
[]
[jobId]
);
return body ? body.hits.hits.map((r) => r._source) : [];
}
@ -583,7 +583,7 @@ export function resultsServiceProvider(mlClient: MlClient, client?: IScopedClust
aggs,
},
},
[]
jobIds
);
if (fieldToBucket === JOB_ID) {
finalResults = {