How to statistics the success rate from some logs

the log data following:

{"time":"2020-05-21 10:10:56.210","level":"Info","transID":1,"span":{"traceID":521,"spanID":1,"tags":[{"userID":93}]},"msg":"TransStart","extend":{"type":"Login"}}
{"time":"2020-05-21 10:10:57.213","level":"Info","transID":1,"span":{"traceID":522,"spanID":2,"tags":[{"userID":93}]}}
{"time":"2020-05-21 10:10:58.218","level":"Error","transID":1,"span":{"traceID":523,"spanID":3,"tags":[{"userID":93}]},"extend":{"result":"Failed"}}
{"time":"2020-05-21 10:11:56.210","level":"Info","transID":2,"span":{"traceID":524,"spanID":1,"tags":[{"userID":932229}]},"msg":"TransStart","extend":{"type":"Login"}}
{"time":"2020-05-21 10:11:57.213","level":"Info","transID":2,"span":{"traceID":525,"spanID":2,"tags":[{"userID":93}]}}
{"time":"2020-05-21 10:11:58.218","level":"Info","transID":2,"span":{"traceID":526,"spanID":3,"tags":[{"userID":93}]},"extend":{"result":"Succ"}}
{"time":"2020-05-21 10:12:56.210","level":"Info","transID":3,"span":{"traceID":527,"spanID":1,"tags":[{"userID":93}]},"msg":"TransStart","extend":{"type":"Login"}}
{"time":"2020-05-21 10:12:57.213","level":"Info","transID":3,"span":{"traceID":528,"spanID":2,"tags":[{"userID":93}]}}
{"time":"2020-05-21 10:12:58.218","level":"Error","transID":3,"span":{"traceID":529,"spanID":3,"tags":[{"userID":93}]},"extend":{"result":"Failed"}}
{"time":"2020-05-21 10:13:56.210","level":"Info","transID":4,"span":{"traceID":530,"spanID":1,"tags":[{"userID":93}]},"msg":"TransStart","extend":{"type":"Login"}}
{"time":"2020-05-21 10:13:57.213","level":"Info","transID":4,"span":{"traceID":531,"spanID":2,"tags":[{"userID":93}]}}
{"time":"2020-05-21 10:13:58.218","level":"Info","transID":4,"span":{"traceID":532,"spanID":3,"tags":[{"userID":93}]},"extend":{"result":"Succ"}}

now I want to statistic the login's seccess rate from these logs.
there are some logs, but according to "transID" can distinguish event,
so we can know the user log in fourth times, and "Failed" twice, "Succ" twice

The question is coming: how can I calculate the succedd rate through aggregation?
there is my ES aggs code:

  "size": 0,
   "aggs": {
     "trans_id": {
       "terms": {
         "field": "transID"
       },
       "aggs":{
         "login":{
           "filter": {
            "term": {
              "extend.type.keyword": "Login"
            }
          }
        },
          "login_succ":{
            "filter": {
              "term": {
                "extend.result.keyword": "Succ"
              }
            }
          },
        "succ_script":{
          "bucket_script": {
            "buckets_path":{
              "succ_count": "login_succ>_count",
              "total_count": "login>_count"
            },
            "format": "#.##", 
            "script":" params.succ_count/params.total_count",
            "gap_policy": "skip"
          }
        }
      }
    }
  }

the response :

 "aggregations" : {
    "trans_id" : {
      "doc_count_error_upper_bound" : 0,
      "sum_other_doc_count" : 0,
      "buckets" : [
        {
          "key" : 5,
          "doc_count" : 4,
          "login" : {
            "doc_count" : 0
          },
          "login_succ" : {
            "doc_count" : 0
          },
          "succ_script" : {
            "value" : null
          }
        },
        {
          "key" : 1,
          "doc_count" : 3,
          "login" : {
            "doc_count" : 1
          },
          "login_succ" : {
            "doc_count" : 0
          },
          "succ_script" : {
            "value" : 0.0,
            "value_as_string" : "0"
          }
        },
        {
          "key" : 2,
          "doc_count" : 3,
          "login" : {
            "doc_count" : 1
          },
          "login_succ" : {
            "doc_count" : 1
          },
          "succ_script" : {
            "value" : 1.0,
            "value_as_string" : "1"
          }
        },
        {
          "key" : 3,
          "doc_count" : 3,
          "login" : {
            "doc_count" : 1
          },
          "login_succ" : {
            "doc_count" : 0
          },
          "succ_script" : {
            "value" : 0.0,
            "value_as_string" : "0"
          }
        },
        {
          "key" : 4,
          "doc_count" : 3,
          "login" : {
            "doc_count" : 1
          },
          "login_succ" : {
            "doc_count" : 1
          },
          "succ_script" : {
            "value" : 1.0,
            "value_as_string" : "1"
          }
        }
      ]
    }

= =# Have Anyone help me?