Weigheted average on es-5.0.0

I tried other things:

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

But I have error:

{
  "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
}

I don't understand.
Can you help me please?

It looks like you have already got a topic for this here: Weighted Average and aggregations

Please do not open duplicate topics.

Closing this topic in favour of Weighted Average and aggregations where you have already had some responses