Geospatial & social graph querying


I'm building a application that needs to find mutual friends in a geo

Has anyone built anything similar using ElasticSearch before? Got any good
recommendations on how to approach it?

Currently I'm using MongoDB where I've denormalized each user's friend list
inside the collection where the geo coordinates are stored i.e:

{ _id: ObjectId("5031a01f0536937d87002f84"),
coordinates: [37.0, -122.0],
user_id: ObjectId("5031a01f0536937d87002f90"),
friend_ids: [ObjectId("5031a01f0536937d87002f89"),

In order to find mutual friends in that location I query using $in and the
current user's friend_ids and do the intersection client side.

This approach works OK for users with a few hundred friends, but query
performance is poor for users with tens of thousands of friends.

Curious to hear how people would approach this using ElasticSeach or using
other technologies.