I'm not hugely familiar with scripted fields, but confused how a scripted field would help me here. Doesn't a scripted field only add a value for each document? Not sure how adding fields to the documents would help us here.
Unless it's possible to add scripts at other levels in the process?
To clarify, this is the max difference of one field (see example below), not the max difference between two separate fields in a document
user widgets
==== =======
1 202
1 354
1 355
1 1023
2 525643
2 525645
user 1 "widgets" delta = 1023-202 = 821
user 2 "widgets" delta = 525645-525643 = 2
Again, am I missing something?