Skip to content

Commit ecd38dd

Browse files
committed
[ML] Replace use of lodash get for obtaining hits total
1 parent b3594cb commit ecd38dd

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

x-pack/plugins/ml/public/application/services/results_service/results_service.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1229,7 +1229,7 @@ export function resultsServiceProvider(mlApiServices) {
12291229
// Because of the sampling, results of metricFunctions which use sum or count
12301230
// can be significantly skewed. Taking into account totalHits we calculate a
12311231
// a factor to normalize results for these metricFunctions.
1232-
const totalHits = get(resp, ['hits', 'total', 'value'], 0);
1232+
const totalHits = resp.hits.total.value;
12331233
const successfulShards = get(resp, ['_shards', 'successful'], 0);
12341234

12351235
let normalizeFactor = 1;

x-pack/plugins/ml/server/models/data_visualizer/data_visualizer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ export class DataVisualizer {
632632
body: searchBody,
633633
});
634634
const aggregations = body.aggregations;
635-
const totalCount = get(body, ['hits', 'total', 'value'], 0);
635+
const totalCount = body.hits.total.value;
636636
const stats = {
637637
totalCount,
638638
aggregatableExistsFields: [] as FieldData[],

0 commit comments

Comments
 (0)