Show number as percentile in elasticsearch DSL

Sample data

Name    response_code  
abc        6780
abc2       9999
abc3       1000
abc4       3456
.
.
.
abc20      9700

I want two perform following task

  1. Show those response_code whoes value is greater than 3000
  2. Show response_code as percentile for example 3000 is 30%

I performed something but don't how to perform percentile

{
  "query": {
    "range": {
      "response_code": {
        "gt": "3000"
      }
    }
  }
}

Percentile of what though?

if response code is 3456 it percentile would be 34.56%. I have to perform this operation on ML if it reached to more than 10 % it would be treated as an anamoly.

Why not alter that during ingestion, or add it on with a runtime field?

Hi @warkolm in kibana visualization we have response code value as percentage.
How to display data as a percentage in Kibana visualization

So i was thinking can we fetch those field either through KQL or normal query.

Except that percentage calculation is done by an aggregation, not being taken directly from the data like you want to do.