Regarding implementing knn for geo-points

Let's say I have an index of geo-json data of restaurants and another index of geo-json data of pharmacies. If I want to get all pharmacies having restaurant with in 100m, How can I do that. Taking each pharmacies coordinate and looking for restaurants with geo_distance does not scale and requires a lot processing so not works for real time. I google and it is like nearest neighbors problem. I thought that I can solve the problem using elasticknn plugin and but I dont know how to consider coordinates as vectors. Can anyone please show some angle about this problem?