Drop empty buckets


I have data table like below. I am looking for a vertical bar chart that will display sum(elapsed_time) per week having min(sequence) of that respective week. Final table will have those asterisk highlighted rows i.e. sequence number 101, 108.

 Week#      Day    Seq.  JobID  Elapsed time    
 2020-25    Sun    101    J1*    10    
 2020-25    Sun    101    J1*    5    
 2020-25    Sun    101    J2*    5    
 2020-25    Mon    101    J3*    20    
 2020-25    Mon    102    J1    …    
 2020-25    Mon    101    J2    …    
 2020-25    Tue    103    J1    …    
 …    …    …    …    …    
 2020-26    Sun    108    J1*    …    
 …        …    …    …    

DSL query is similar to this:

      "aggregations": {
         "week_of_year": {
            "terms": { "field": "week_of_year" },
          "aggregations": {
             "job_name.keyword": {
               "terms": { "field": "job_name.keyword" },
               "aggregations": {
                 "sequence.min": { 
                   "min": { "field": "sequence" }

When I try to display that on bar chart, I get lot of empty 'sequence' buckets.

I couldn't find a way to do min(sequence) on bar chart and the reason I am doing split chart instead of split series for sequence field is because I want to have legend like Job1, Job2 not like Seq1 - Job1, Seq2 - Job1 etc.

I am wondering whether it's possible to do that on Kibana, dropping those empty buckets

I also tried transform wizard thinking to transfer data to new index removing those empty buckets but it didn't accept my nested aggregation citing duplicated "week_of_year" issue


If you use a histogram aggregation instead of a terms aggregation then there is a an option to drop empty buckets

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