Percentile ranking question


(stoffel) #1

Hi,

I have the following list of data:
[ 2.625, 3.0, 3.5, 3.5, 3.5, 3.875, 4.375, 4.75, 4.875, 4.875, 5.0, 5.125, 5.125, 5.375, 5.375, 5.5, 5.625, 5.625]

when I use the following query to get the percentile ranks for the given values
{
"aggregations" : {
"agg" : {
"percentile_ranks" : {
"field" : "score",
"values" : [2.55, 2.625, 3.0, 3.5, 3.875, 4.375, 4.75, 4.875, 5.0, 5.125, 5.375, 5.5, 5.625 ]
}
}
}
}

I get the following:
{
"took" : 5,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 19,
"max_score" : 1.0,
"hits" : [ ]
},
"aggregations" : {
"agg" : {
"values" : {
"2.55" : 1.6666666666666643,
"2.625" : 2.7777777777777777,
"3.0" : 7.936507936507936,
"3.5" : 22.22222222222222,
"3.875" : 30.15873015873016,
"4.375" : 36.507936507936506,
"4.75" : 43.05555555555556,
"4.875" : 50.0,
"5.0" : 58.333333333333336,
"5.125" : 66.66666666666666,
"5.375" : 77.77777777777779,
"5.5" : 86.11111111111111,
"5.625" : 100.0
}
}
}
}

2.625 is the lowest value , so shouldn't 2.55 be 0?, and 5.625 is the max and according to other sources it should be at around 94 and everything higher than 5.625 should be 100.
Are these values returned from elastic search correct or is this a bug?


(system) #2