Bytes to kbytes

So i have metricbeats running. I am trying to create a visualization for the reads & writes but in kbytes unit. is scripted field the correct way to achieve it? i tried one but it's giving me this error.

     "script" : "doc['system.diskio.write.bytes'] / 1024",
      "lang" : "painless",
      "caused_by" : {
        "type" : "class_cast_exception",
        "reason" : "Cannot apply [/] operation to types [org.elasticsearch.index.fielddata.ScriptDocValues.Longs] and [java.lang.Integer]."
      }
    }

Appreciate your help/tips.
regards,
SirJune