Elasticsearc-5.0.0加权平均值

时间:2016-12-06 06:19:22

标签: elasticsearch average

我想在ES-5.0.0上尝试加权平均值。 我用json代码尝试了一些东西:

GET ABC/xyz/_search 
{
  "aggs": {
    "myAggr": {
      "terms": {
        "field": "UrunNo",
        "order": { "weightedAvg": "desc"}
      },  
      "aggs": {
          "weightedAvg": { "avg" : { "script" : "[values: doc['BirimFiyat'].value, weights: doc['Adet'].value]" }}
       }    }  }  }

我有错误:

  {"error": {
        "root_cause": [
          { "type": "parsing_exception",
            "reason": "Unexpected token VALUE_STRING [script] in [weightedAvg].",
            "line": 9,
            "col": 49
          } ],
        "type": "parsing_exception",
        "reason": "Unexpected token VALUE_STRING [script] in [weightedAvg].",
        "line": 9,
        "col": 49
      },"status": 400 }

有什么问题?或ES-5.0.0是否可以加权平均值?

0 个答案:

没有答案