I read about "Percentiles Aggregation" and know already about "relative error".
In my case, I have to calculate correctly.
I have 45 values greater than 0.4
and 1 values smaller than 0.4
So correct return percentile have to be (1\45*100) =2.2222,
but I get "0.4": 1.6760828741290288.
How is it possible to calculate the correct values?
My Current request lool like
I read here that max aggregation can solve the issue but I can not apply it.
{     "size": 0,     "query": {         "bool": {             "must": [                 {                     "query_string": {                         "query": "status:R OR status:Q OR status:P",                         "fields": [],                         "type": "best_fields",                         "default_operator": "or",                         "max_determinized_states": 10000,                         "enable_position_increments": true,                         "fuzziness": "AUTO",                         "fuzzy_prefix_length": 0,                         "fuzzy_max_expansions": 50,                         "phrase_slop": 0,                         "analyze_wildcard": true,                         "escape": false,                         "auto_generate_synonyms_phrase_query": true,                         "fuzzy_transpositions": true,                         "boost": 1                     }                 },                 {                     "range": {                         "final_date": {                             "from": 1577836800000,                             "to": 1583020800000,                             "include_lower": true,                             "include_upper": false,                             "format": "epoch_millis",                             "boost": 1                         }                     }                 }             ],             "adjust_pure_negative": true,             "boost": 1         }     },     "aggregations": {         "terms": {             "terms": {                 "field": "station_code.keyword",                 "size": 300,                 "min_doc_count": 1,                 "shard_min_doc_count": 0,                 "show_term_doc_count_error": false,                 "order": {                     "_key": "asc"                 }             },             "aggregations": {                 "histogram": {                     "date_histogram": {                         "field": "final_date",                         "format": "epoch_millis",                         "interval": "1M",                         "offset": 0,                         "order": {                             "_key": "asc"                         },                         "keyed": false,                         "min_doc_count": 0,                         "extended_bounds": {                             "min": 1577836800000,                             "max": 1582934400000                         }                     },                     "aggregations": {                         "aggregation": {                             "percentile_ranks": {                                 "field": "value",                                 "values": [0.4],                                 "keyed": true,                                 "tdigest": {                                     "compression": 100                                 }                             }                         }                     }                 }             }         }     } }
Thanks for response if any )