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
document?

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!

Tom.

--
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 elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/7cc7b619-f06e-4bd4-9da0-03dbf26e3b5c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.