GeoDistance search with dynamic distance

I have a product database, where products have a set delivery zones,
represented in elasticsearch as an array:

distance: double (in miles),
location: geohash (source location of product/seller),
deliveryprice: double

does anyone have any idea how I can filter using the distance within the

I know the co-ordinates of my users, and I like to filter out products that
don't cannot be delivered to their location - in other words, where the
distance "double" field is greater than the distance between their
co-ordinates and the source co-ordinates of the product.

All the examples of goedistance filtering I've seen require the distance to
be provided in the query - not analysed from the document itself.

I'm not sure if I can use scripting to do this - if so, how?

Any help would be hugely appreciated!


You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit
For more options, visit