Hi all
I have created the below Elastic search query pipe line aggregation to calculate percentage based on my event data.
I would like to know how to use this same in Kibana. i want to make the percentage value to get displayed in any of the visualization (Metric,table, etc.,)
{
"aggs": {
"totrecords": {
"date_histogram": {
"field": "@timestamp",
"interval": "month",
"format": "yyyy-MM-dd"
},
"aggs": {
"totcount": {
"value_count": {
"field": "@timestamp"
}
},
"num_record": {
"filter": {
"term": {
"NUM_RECORDS": "0"
}
},
"aggs": {
"numcount": {
"value_count": {
"field": "NUM_RECORDS"
}
}
}
},
"bmw_percentage": {
"bucket_script": {
"buckets_path": {
"numcnt": "num_record>numcount",
"totalcnt": "totcount"
},
"script": " numcnt / totalcnt * 100"
}
}
}
}
}
}