# GeoPoint Script Processing

**URL:** <https://discuss.elastic.co/t/geopoint-script-processing/126150>\
**Category:** Elasticsearch\
**Created:** [March 29, 2018, 7:19pm UTC](https://discuss.elastic.co/t/geopoint-script-processing/126150 "2018-03-29T19:19:13Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ESmonkey](https://avatars.discourse-cdn.com/v4/letter/e/ea5d25/32.png) [@ESmonkey](https://discuss.elastic.co/u/ESmonkey)\
**Post date:** [March 29, 2018, 7:19pm UTC](https://discuss.elastic.co/t/geopoint-script-processing/126150/1 "2018-03-29T19:19:14Z")

</div>

I wanted to use script term aggregation to process array of Geo point locations using arcDistance function in painless. But it seems like the arcDistance function always takes the first (lat,lon) location to do distance measurement. is there any way to access the rest of the locations in the array of geopoints..

Thanks

---

<div class="post-metadata">

**Author:** ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)\
**Post date:** [April 6, 2018, 2:14pm UTC](https://discuss.elastic.co/t/geopoint-script-processing/126150/2 "2018-04-06T14:14:35Z")

</div>

This issue is tracked in [https://github.com/elastic/elasticsearch/issues/25796](https://github.com/elastic/elasticsearch/issues/25796)

---

<div class="post-metadata">

**Author:** ![ESmonkey](https://avatars.discourse-cdn.com/v4/letter/e/ea5d25/32.png) [@ESmonkey](https://discuss.elastic.co/u/ESmonkey)\
**Post date:** [April 9, 2018, 11:59pm UTC](https://discuss.elastic.co/t/geopoint-script-processing/126150/3 "2018-04-09T23:59:53Z")

</div>

Ok thanks! I did not realize this is a limitation on elastic search part. Is there a work around aside from implementing custom location distance function?

---

<div class="post-metadata">

**Author:** ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)\
**Post date:** [April 10, 2018, 12:38pm UTC](https://discuss.elastic.co/t/geopoint-script-processing/126150/4 "2018-04-10T12:38:45Z")

</div>

Storing one point per field, implementing it as custom native script plugin, or the workaround at the end of the issue is pretty much all I can think of at the moment. However, fixing this issue in elasticsearch is pretty high on my priority list.

---

<div class="post-metadata">

**Author:** ![ESmonkey](https://avatars.discourse-cdn.com/v4/letter/e/ea5d25/32.png) [@ESmonkey](https://discuss.elastic.co/u/ESmonkey)\
**Post date:** [April 10, 2018, 11:30pm UTC](https://discuss.elastic.co/t/geopoint-script-processing/126150/5 "2018-04-10T23:30:59Z")

</div>

Ok great! thanks. I will take the native script plugin route for the time being.

---

<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:** [May 8, 2018, 11:31pm UTC](https://discuss.elastic.co/t/geopoint-script-processing/126150/6 "2018-05-08T23:31:21Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
