Clustering customer data stored in ElasticSearch
One algorithm that can be used for this is the k-means clustering algorithm.

Basically:


Randomly choose k datapoints from your set, m_1, ..., m_k.
"Until convergence":


Assign your data points to k clusters, where cluster i is the set of points for which m_i is the closest of your current means
Replace each m_i by the mean of all points assigned to cluster i.



It is good practice to repeat this algorithm several times, then choose the outcome that minimizes distances between the points of each cluster i and the center m_i.

Of course, you have to know k to start here; you can use cross-validation to choose this parameter, though.