【发布时间】:2014-10-09 10:53:34
【问题描述】:
我正在尝试使用 Kibana 中基于时间/类别/供应商等的直方图即时计算平均利润率。数据库从一开始就没有计算出的边际 (参见下面的索引)。
我需要通过(Netvalue - Cost)/NetValue * 100 计算利润率并将结果显示在直方图中。
是否可以制作一个 groovy 函数或类似于 this 但在直方图中使用结果?
几天来一直在尝试让某些东西正常工作,但我就是不知道该走哪条路,或者即使可以在查询级别的 kibana 中做到这一点。
{
"Mycompany": {
"mappings": {
"sales": {
"properties": {
"Cost": {
"type": "double"
},
"DocumentDate": {
"format": "dateOptionalTime",
"type": "date"
},
"ItemCategory": {
"index": "not_analyzed",
"type": "string"
},
"ManufacturerName": {
"index": "not_analyzed",
"type": "string"
},
"MaterialGroup2description": {
"index": "not_analyzed",
"type": "string"
},
"MaterialGroup4description": {
"index": "not_analyzed",
"type": "string"
},
"NetPrice": {
"type": "double"
},
"NetValue": {
"type": "double"
},
"OrderQuantity": {
"type": "long"
}
}
}
}
}
}
【问题讨论】:
-
据我所知,您想要实现的目标有点不清楚。举几个例子。
标签: groovy lucene elasticsearch histogram kibana