I have a project that enables users to search for POIs using Elasticsearch, and they can filter by a number of different attributes, including location. I'd like to add faceting to all of the filters, most of which are categorical variables for which faceting is perfect. However, I also want users to be able to facet by location/city/metro area. Each location is currently a lat/long pair.
From my research, it seems that the best approach is to use k-means clustering of the lat/long pairs to get the most common groupings of locations for faceting. Once I have those groupings, I would want to provide the most commonly recognizable name for the area (e.g., even if "Brooklyn" was the center of a cluster, I'd want to provide the name "New York City").
(a) Can geo-clustering (k-means, or any other way) be done in Elasticsearch to allow faceting by location? If so, how? If not, can this be done in Postgres instead?
(b) How can I make sure that I'm providing the most widely recognizable political name for any given region returned by the clustering?