# Calculating ArcDistance of a geopoint field within an object field

**URL:** <https://discuss.elastic.co/t/calculating-arcdistance-of-a-geopoint-field-within-an-object-field/17027>\
**Category:** Elasticsearch\
**Created:** [April 15, 2014, 2:18pm UTC](https://discuss.elastic.co/t/calculating-arcdistance-of-a-geopoint-field-within-an-object-field/17027 "2014-04-15T14:18:30Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Umami](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/umami/32/1652_2.png) [@Umami](https://discuss.elastic.co/u/Umami)\
**Post date:** [April 15, 2014, 2:18pm UTC](https://discuss.elastic.co/t/calculating-arcdistance-of-a-geopoint-field-within-an-object-field/17027/1 "2014-04-15T14:18:30Z")

</div>

I am trying to obtain geodistance values for records in cases where  
geodistance is not the primary purpose of the search (i.e. do not want it  
to affect score/sort not included in a query/filter), but where that  
information might be useful anyway.  
As outlined in these example cases  
[https://gist.github.com/alexeiemam/04eda6fff5915f9cef66](https://gist.github.com/alexeiemam/04eda6fff5915f9cef66), script\_field can  
be used to obtain geodistance on a top level geopoint (example 3), but not  
within an object field with geopoint fields (examples 4 and 5). Sorting by  
geodistance, however, deals with geopoints within object fields without  
issue (examples 1 and 2).  
Is there any way to access these distance values outside of sorting?  
Are there any known workarounds or suggestions?

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/e46093f9-d9a1-41ea-83bc-587219cf44aa%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/e46093f9-d9a1-41ea-83bc-587219cf44aa%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Binh\_Ly\_2](https://avatars.discourse-cdn.com/v4/letter/b/d07c76/32.png) [@Binh\_Ly\_2](https://discuss.elastic.co/u/Binh_Ly_2)\
**Post date:** [April 16, 2014, 5:57pm UTC](https://discuss.elastic.co/t/calculating-arcdistance-of-a-geopoint-field-within-an-object-field/17027/2 "2014-04-16T17:57:45Z")

</div>

Strange. The only thing I can think of is you have a document that does not  
have a value for the field: doc.all\_places.location\_point. Can you narrow  
down your search to only documents that contain that field and check?  
Thanks!

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/b06501d5-7031-4ea3-831c-1b7ffdc2a190%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/b06501d5-7031-4ea3-831c-1b7ffdc2a190%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Umami](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/umami/32/1652_2.png) [@Umami](https://discuss.elastic.co/u/Umami)\
**Post date:** [April 16, 2014, 6:50pm UTC](https://discuss.elastic.co/t/calculating-arcdistance-of-a-geopoint-field-within-an-object-field/17027/3 "2014-04-16T18:50:02Z")

</div>

In the linked example I have only one record, and it contains data for all fields.

On 16 Apr 2014, at 18:57, "Binh Ly" \<[binhly\_es@yahoo.com](mailto:binhly_es@yahoo.com)[mailto:binhly\_es@yahoo.com](mailto:binhly_es@yahoo.com)\> wrote:

Strange. The only thing I can think of is you have a document that does not have a value for the field: doc.all\_places.location\_point. Can you narrow down your search to only documents that contain that field and check? Thanks!

--  
You received this message because you are subscribed to a topic in the Google Groups "elasticsearch" group.  
To unsubscribe from this topic, visit [https://groups.google.com/d/topic/elasticsearch/eg0\_wuHMKH4/unsubscribe](https://groups.google.com/d/topic/elasticsearch/eg0_wuHMKH4/unsubscribe).  
To unsubscribe from this group and all its topics, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com)[mailto:elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/b06501d5-7031-4ea3-831c-1b7ffdc2a190%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/b06501d5-7031-4ea3-831c-1b7ffdc2a190%40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/b06501d5-7031-4ea3-831c-1b7ffdc2a190%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/b06501d5-7031-4ea3-831c-1b7ffdc2a190%40googlegroups.com?utm_medium=email&utm_source=footer).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

This communication is from Chapter Media Limited. This email (including any attachments) is intended only for the recipient(s) named above. It may contain confidential or privileged information. If you are not the intended recipient, please do not read, distribute, copy or otherwise use this communication or the information in it. Any views or opinions expressed in this email may be solely those of the author and are not necessarily those of Chapter Media Limited

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/53E8A08F-E170-466E-8BB5-D7A9C1303651%40chaptermedia.com](https://groups.google.com/d/msgid/elasticsearch/53E8A08F-E170-466E-8BB5-D7A9C1303651%40chaptermedia.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Umami](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/umami/32/1652_2.png) [@Umami](https://discuss.elastic.co/u/Umami)\
**Post date:** [April 17, 2014, 7:57am UTC](https://discuss.elastic.co/t/calculating-arcdistance-of-a-geopoint-field-within-an-object-field/17027/4 "2014-04-17T07:57:42Z")

</div>

In the linked example I have only one record, and it contains data for all fields.

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/8bf32028-6161-4ef0-9163-100fd0526ce7%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/8bf32028-6161-4ef0-9163-100fd0526ce7%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Umami](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/umami/32/1652_2.png) [@Umami](https://discuss.elastic.co/u/Umami)\
**Post date:** [April 17, 2014, 12:24pm UTC](https://discuss.elastic.co/t/calculating-arcdistance-of-a-geopoint-field-within-an-object-field/17027/5 "2014-04-17T12:24:47Z")

</div>

Apologies the #create document section of the gist was incorrectly  
repeating the index mapping  
I have updated  
it: [Elasticsearch Tests :: Access GeoDistance without distance sorting in object field · GitHub](https://gist.github.com/alexeiemam/04eda6fff5915f9cef66#file-es_geo_distance-sh-L23)

On Wednesday, April 16, 2014 6:57:45 PM UTC+1, Binh Ly wrote:

> Strange. The only thing I can think of is you have a document that does  
> not have a value for the field: doc.all\_places.location\_point. Can you  
> narrow down your search to only documents that contain that field and  
> check? Thanks!

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/a4bba25c-34cf-402f-924b-798dc6bd9381%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a4bba25c-34cf-402f-924b-798dc6bd9381%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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 6, 2017, 1:35am UTC](https://discuss.elastic.co/t/calculating-arcdistance-of-a-geopoint-field-within-an-object-field/17027/6 "2017-07-06T01:35:16Z")

</div>


