# Rank by distance between geo\_shape and geo\_point

**URL:** https://discuss.elastic.co/t/rank-by-distance-between-geo-shape-and-geo-point/60757
**Category:** Elasticsearch
**Created:** [September 16, 2016, 9:35pm UTC](https://discuss.elastic.co/t/rank-by-distance-between-geo-shape-and-geo-point/60757 "2016-09-16T21:35:08Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![ckoppelman](https://avatars.discourse-cdn.com/v4/letter/c/f19dbf/32.png) [@ckoppelman](https://discuss.elastic.co/u/ckoppelman)
#### Post date: [September 16, 2016, 9:35pm UTC](https://discuss.elastic.co/t/rank-by-distance-between-geo-shape-and-geo-point/60757/1 "2016-09-16T21:35:08Z")

</div>

I have a sparsely-populated geography filled with smallish geoshapes (service areas). Given a geopoint or if possible, multiple geopoints (user location/s), I want to return results of a search ranked (in part) by proximity.

The scripting module provides an easy way to rank by distance between two geopoints: [https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html)

Is there a way to rank by distance between a geopoint and a geoshape or between two geoshapes?

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [July 5, 2017, 10:19pm UTC](https://discuss.elastic.co/t/rank-by-distance-between-geo-shape-and-geo-point/60757/2 "2017-07-05T22:19:31Z")

</div>


