There is not currently an aggregation which performs clustering. There is an issue for adding k-means clustering as an aggregation (https://github.com/elastic/elasticsearch/issues/5512) and I played around with a prototype for this a while ago but there are some changes that would need to be made to the aggregations framework itself to support this kind of aggregation and that work is yet to be done.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.