Properly read new percentile agg format#6309
Conversation
03d8ac9 to
a4afa37
Compare
| }) / 100; | ||
| const values = bucket[agg.parentId] && bucket[agg.parentId].values; | ||
| const percentile = _.find(values, value => agg.key === value.key); | ||
| return percentile ? percentile.value / 100 : null; |
There was a problem hiding this comment.
The existing behavior would always return a number, can you think of any circumstances where returning null would cause issues?
There was a problem hiding this comment.
I can't, but I suppose NaN is as good a default as any in this scenario.
|
Confirmed that #6228 fixes the fatal error issue. |
|
We should get tests for some of this, but since this bug is currently blocking green builds on valid PRs, let's get this through. LGTM |
Properly read new percentile agg format
|
Looks like the format change was a but in Elasticsearch and was recently fixed: elastic/elasticsearch#17217 Do we still need this change in v5.0.0 then? |
|
@tbragin that bug was about the default format, we want to use the new format because it gives us actual numbers, not strings that we parse into numbers |
* Test utils * Test get_configure * Test post_configure * Test get_connectors * Test patch_configure * Improve test * Fixes Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>


Built on top of #6308, which is required for the tests to pass.
Sometime recently the percentile aggregation's response format is changed from:
{ "values": { "0.0": 123, "99.0": 456 } }to
{ "values": [ { "key": 0, "value": 123 }, { "key": 99, "value": 456 } ] }