How to get only n documents for each value

Sorry, I'm not familiar with any single ES query that would solve a proximity problem like that. The brute force approach of iterating through your set of points and running that Geo Distance Range Query is probably the most straightforward, but you may be able to implement something faster using computational geometry, like in the closest pair of points problem.