How to find percentage using doc_count in elastic query

I am having an elastic result like below.
{
"key" : "2020-02-18T09:10:14.453Z-2020-02-26T09:10:14.453Z",
"from" : 1.582017014453E12,
"from_as_string" : "2020-02-18T09:10:14.453Z",
"to" : 1.582708214453E12,
"to_as_string" : "2020-02-26T09:10:14.453Z",
"doc_count" : 11237096,
"ISG-TMX-FAILED" : {
"doc_count" : 4731815
}
}

I want to get the value 4731815/11237096 to get the percentage of failures.

my query is below:

POST index/_search
{
  "query": {
    "bool": {
      "filter": {
        "bool": {
      "must": [
       
        {"match": {"D": "ISp"}}
        
      ]
    }
      }
    }
  }, 
    "aggs" : {
        "ISG-TMX-YES" : {
           "date_range": {
             "field": "td.XCN",
             "ranges": [
               {
                 "from": "now-2d",
                 "to": "now"
                 
               },
               {
                 "from": "now-10d",
                 "to": "now-2d"
               
               }
             ]
           },
           "aggs": {
             "ISG-TMX-FAILED": {
               "missing": {
                 "field": "tmx.compositeKey.requestTimeStamp"
               }
             }
           }
        }
}
  
  
}

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.