Skip to content

Commit

Permalink
[ML] Replace use of lodash get for obtaining hits total
Browse files Browse the repository at this point in the history
  • Loading branch information
peteharverson committed Sep 29, 2020
1 parent b3594cb commit ecd38dd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1229,7 +1229,7 @@ export function resultsServiceProvider(mlApiServices) {
// Because of the sampling, results of metricFunctions which use sum or count
// can be significantly skewed. Taking into account totalHits we calculate a
// a factor to normalize results for these metricFunctions.
const totalHits = get(resp, ['hits', 'total', 'value'], 0);
const totalHits = resp.hits.total.value;
const successfulShards = get(resp, ['_shards', 'successful'], 0);

let normalizeFactor = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ export class DataVisualizer {
body: searchBody,
});
const aggregations = body.aggregations;
const totalCount = get(body, ['hits', 'total', 'value'], 0);
const totalCount = body.hits.total.value;
const stats = {
totalCount,
aggregatableExistsFields: [] as FieldData[],
Expand Down

0 comments on commit ecd38dd

Please sign in to comment.