Create visualize -> Success rate based on time


I'm using 7.16.2, here are the fields I've in my index... it holding data on builds in Jenkins.. build number, status: pass or fail...

I need to create a graph of success rate based on time.. for example: % of the tests Passed per week.
e.g.: Week1 - 90%, week 2-85%, week 3- 70%, week 4- 100%...

Can you help me understand how to build this kind of graph?

"hits" : [
        "_index" : "buildsfailures",
        "_type" : "_doc",
        "_id" : "AvAe330BtYsQZh-CKKj7",
        "_score" : null,
        "_source" : {
          "buildNumber" : 10948,
          "buildStatus" : "FAILURE",
          "displayName" : "#10948",
          "duration" : "00:0:10",
          "timestamp" : "2021-12-20T00:08:06.818Z",
          "url" : ""
        "sort" : [

Thanks in advance,

I will ask a simple question... Can I group a fields by time? For example by week?

You can do this in Lens - drag timestamp field the horizontal axis, then customize the interval and set it to weekly. After this, configure the vertical axis via lens formula: count(kql="buildStatus: SUCCESS")/count(). This should give you the chart you want to see

1 Like