【问题标题】:Kibana Historgram calculate profit/gross margin based on field valuesKibana 直方图根据字段值计算利润/毛利率
【发布时间】: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


【解决方案1】:

Kibana 4 引入了可用于直方图等的脚本字段

enter link description here

【讨论】:

    猜你喜欢
    • 2015-06-11
    • 2013-01-16
    • 2018-08-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-05-09
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多