Weighted Average and aggregations

Actually I did something:

GET titubb56k/ihale/_search 
{
"size":0,
  "query": {"match": { "UrunNo":  "99" } },
  "aggs":{
      "group_by_tarih":{
        "terms":{ "field": "AlimTarihi",
        "order":{
            "Birim_Fiyat_agirlik_ort":"asc"
          }},
          "aggs" : {
         "Birim_Fiyat_agirlik_ort": {"avg" : { "script" : "[value: doc['BirimFiyat'].value, weight: doc['Adet'].value]" }}
          }  }  }}

but I have error:

{
  "error": {
    "root_cause": [
      {
        "type": "parsing_exception",
        "reason": "Unexpected token VALUE_STRING [script] in [Birim_Fiyat_agirlik_ort].",
        "line": 11,
        "col": 72
      }
    ],
    "type": "parsing_exception",
    "reason": "Unexpected token VALUE_STRING [script] in [Birim_Fiyat_agirlik_ort].",
    "line": 11,
    "col": 72
  },
  "status": 400
}