Measuring the distance between two distributions of vectors

I have 2 buckets.
Each bucket holds documents.
Each document has a vector field.
I want to measure the distance between them.
To measure the distance, I need to take the mean vector out of each bucket , and calculate the delta between them.

What the best way to save the vectors ( knn_vector ? spread the vector to discrete field x0 , x1 , x2 ?) and perform the calculation of the mean vector? (Painless script that iterates the vector, save in the state the sum of each dimension and calculate the average in the reduce_script ?)