[ML] APM Correlations: Fix percentiles values. (#116639) (#117098)

A change in the ES range agg no longer accepts numbers with decimals if the underlying field is typed as long. This PR fixes the issue by rounding the percentiles values we pass on to the range agg.

Co-authored-by: Walter Rafelsberger <walter@elastic.co>
This commit is contained in:
Kibana Machine 2021-11-02 08:57:57 -04:00 committed by GitHub
parent 5391e98f54
commit 1fe9775948
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -151,7 +151,11 @@ export const latencyCorrelationsSearchServiceProvider: LatencyCorrelationsSearch
params,
percentileAggregationPercents
);
const percentiles = Object.values(percentilesRecords);
// We need to round the percentiles values
// because the queries we're using based on it
// later on wouldn't allow numbers with decimals.
const percentiles = Object.values(percentilesRecords).map(Math.round);
addLogMessage(`Loaded percentiles.`);