Hi,
I’m trying to display an elasticsearch-5.3.0 scripted aggregation in grafana-4.2.0. I can’t figure out where to setup my aggregation script in the grafana UI
Elasticsearch 5.3.0 script:
{
“scripted_metric”: {
“init_script”: “_agg[‘transactions’] = ”,
“map_script”: “if (doc[‘type’].value == "sale") { _agg.transactions.add(doc[‘amount’].value) } else { _agg.transactions.add(-1 * doc[‘amount’].value) }”,
“combine_script”: “profit = 0; for (t in _agg.transactions) { profit += t }; return profit”,
“reduce_script”: “profit = 0; for (a in _aggs) { profit += a }; return profit”
}
}
Grafana:
Regards,
Ankur