Hi Guys, currently, i have a requirement about kibana visualize tab, i want to display the division result of two sum(field). how can i display that result.
my script is
{
"query": {
"bool": {
"must": [
{
"query_string": {
"analyze_wildcard": true,
"query": "站点"
}
},
{
"match_phrase": {
"tradeType": {
"query": "Recharge"
}
}
},
{
"range": {
"dbTime": {
"gte": 1503803048541,
"lte": 1503889448541,
"format": "epoch_millis"
}
}
}
],
"must_not": []
}
},
"size": 0,
"_source": {
"excludes": []
},
"aggs": {
"5": {
"date_range": {
"field": "dbTime",
"ranges": [
{
"from": "now-1d/d+2h",
"to": "now/d+2h"
}
]
},
"aggs": {
"4": {
"terms": {
"field": "stationCode.keyword",
"size": 100,
"order": {
"1": "desc"
}
},
"aggs": {
"1": {
"sum": {
"field": "payAmount"
}
},
"3": {
"sum": {
"field": "tradeAmount"
}
},
"division" : {
"bucket_script": {
"buckets_path": {
"my_var1": "1",
"my_var2": "3"
},
"script": "params.my_var1 / params.my_var2"
}
}
}
}
}
}
}
}
i want to display the division in the table.