goware / geotools

Geo-location lookup library / service built on Google Maps API
MIT License
2 stars 1 forks source link

Investigation of Elastic Search geo capabilities #1

Open fergalwalsh opened 8 years ago

fergalwalsh commented 8 years ago

@pkieltyka I did some reading and experimenting with Elastic Search for geo searches. These are my findings:

Requirements as discussed:

  1. associate each Hub with a Point, Box, or Circle (point & radius)
  2. find the N nearest Hubs matching our search terms (with no limit to the distance)

    The Problem: How do we store the geo info?

Two relevant type of geo fields:

geo_point supports filtering by Distance or by Bounding Box and sorting by Distance (using _geo_distance)

geo_shape supports filtering by other geo_shapes (e.g. all shapes within a circle or bounding box) but it does not support sorting at all.

The unfortunate result here is that neither field type satisfies both requirements.

Possible Solutions

  1. Simplify requirement 1 to associate only a simple point (geo_point) with the Hub.
  2. Use 2 fields, a geo_shape for denoting the hub target area and a geo_point as the centroid of this area to use for sorting (finding nearest N)
  3. Use Postgres to store the location field for the hubs. It supports filtering and sorting on any type of geometry. We would need to join the Postgres and ES queries though.
pkieltyka commented 8 years ago

Btw, currently we don't store any geo-data.. so I'm looking for guidance from you on the best way we should store it.

I do want to know the city, state and country for any geo-point tho.. or of course if we don't even have a point, we just have a "place" we need to make it all work too.

the geo work is all greenfield for us.. so hopefully you can guide us on it

pkieltyka commented 8 years ago

the shape was just one of my naive ideas.. perhaps we dont need if you can achieve what I describe in the README