Skip to content

Commit

Permalink
[ML] fallback to 0 in case max bucket cardinality receives null
Browse files Browse the repository at this point in the history
  • Loading branch information
darnautov committed Mar 18, 2020
1 parent 0ec7263 commit 7bdf515
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ export function fieldsServiceProvider(callAsCurrentUser: APICaller) {
}

return aggregatableFields.reduce((obj, field) => {
obj[field] = (aggregations[getMaxBucketAggKey(field)] || { value: 0 }).value;
obj[field] = (aggregations[getMaxBucketAggKey(field)] || { value: 0 }).value ?? 0;
return obj;
}, {} as { [field: string]: number });
}
Expand Down

0 comments on commit 7bdf515

Please sign in to comment.