Trying to calculate time difference using scripted fields

please try the following

doc['netflow.last_switched'].value.millis - doc['netflow.first_switched'].value.millis