# Geo\_shape field not being returned with explicit 'fields' query

**URL:** <https://discuss.elastic.co/t/geo-shape-field-not-being-returned-with-explicit-fields-query/19397>\
**Category:** Elasticsearch\
**Created:** [August 21, 2014, 5:51pm UTC](https://discuss.elastic.co/t/geo-shape-field-not-being-returned-with-explicit-fields-query/19397 "2014-08-21T17:51:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![fatisar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fatisar/32/22239_2.png) [@fatisar](https://discuss.elastic.co/u/fatisar)\
**Post date:** [August 21, 2014, 5:51pm UTC](https://discuss.elastic.co/t/geo-shape-field-not-being-returned-with-explicit-fields-query/19397/1 "2014-08-21T17:51:37Z")

</div>

Hi all,

I'm trying to query for a particular subset of fields, one of which is a  
geo\_shape. All of the other fields are returned as expected, _aside from  
the geo shape_. Here is a trimmed-down version of my mapping:

{  
"house": {  
"properties": {  
"id": {"type": "string"},  
"location": {  
"properties": {  
"geo": {"type": "geo\_shape", "store": true},  
"address": {"type": "string"}  
}  
}  
}  
}  
}

And here are some sample queries I've tried:

{  
"fields": ["id", "location.address", "location.geo"],  
"query": {"match\_all": {}}  
}

{  
"fields": ["id", "location.address", "location.geo._coordinates_"],  
"query": {"match\_all": {}}  
}

{  
"fields": ["id", "location.address", "_\_source_.location.geo"],  
"query": {"match\_all": {}}  
}

{  
"fields": ["id", "location.address", "_\_all_.location.geo"],  
"query": {"match\_all": {}}  
}

The search results always come back with only id and location.address.

Here's a sample document that was returned by a match\_all query:

{  
"id": "a04db707a0b0c8778abb4a25d92bd1a53801b994",  
"location": {  
"geo": {  
"type": "point",  
"coordinates": [-100,40]  
},  
"address": "123 Fake St."  
}  
}

Any thoughts on how to get a geo\_shape returned? Thanks in advance!

Daniel

--  
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/97480273-fa66-4763-819f-50355bc74edb%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/97480273-fa66-4763-819f-50355bc74edb%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Michael\_Dillon](https://avatars.discourse-cdn.com/v4/letter/m/ee7513/32.png) [@Michael\_Dillon](https://discuss.elastic.co/u/Michael_Dillon)\
**Post date:** [October 17, 2014, 5:12am UTC](https://discuss.elastic.co/t/geo-shape-field-not-being-returned-with-explicit-fields-query/19397/2 "2014-10-17T05:12:19Z")

</div>

I have the same problem. It seems that any geo\_shape type (envelope, point,  
polygon, etc) is ignored if it's listed in the 'fields'.

ES version 1.3.4 on Ubuntu 14.04 using Java(TM) SE Runtime Environment  
(build 1.7.0\_55-b13)

Mike

On Thursday, August 21, 2014 11:51:37 AM UTC-6, Daniel Sarfati wrote:

> Hi all,
> 
> I'm trying to query for a particular subset of fields, one of which is a  
> geo\_shape. All of the other fields are returned as expected, _aside from  
> the geo shape_. Here is a trimmed-down version of my mapping:

--  
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/221649ae-7ec8-497a-bf12-d5595f9c3dae%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/221649ae-7ec8-497a-bf12-d5595f9c3dae%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Michael\_Dillon](https://avatars.discourse-cdn.com/v4/letter/m/ee7513/32.png) [@Michael\_Dillon](https://discuss.elastic.co/u/Michael_Dillon)\
**Post date:** [October 24, 2014, 7:03am UTC](https://discuss.elastic.co/t/geo-shape-field-not-being-returned-with-explicit-fields-query/19397/3 "2014-10-24T07:03:16Z")

</div>

Based on this  
[http://www.elasticsearch.org/guide/en/elasticsearch/reference/1.4/mapping-geo-shape-type.html#\_sorting\_and\_retrieving\_index\_shapes](http://www.elasticsearch.org/guide/en/elasticsearch/reference/1.4/mapping-geo-shape-type.html#_sorting_and_retrieving_index_shapes),  
I suppose the behavior is 'as designed':

"Due to the complex input structure and index representation of shapes, it  
is not currently possible to sort shapes or retrieve their fields directly.  
The geo\_shape value is only retrievable through the \_source field."

I haven't tried it, but a workaround might be to only index the geo\_shape  
value without storing it. But, in another string field, store the value  
without analyzing it.

On Thursday, October 16, 2014 11:12:19 PM UTC-6, mdd wrote:

> I have the same problem. It seems that any geo\_shape type (envelope,  
> point, polygon, etc) is ignored if it's listed in the 'fields'.
> 
> ES version 1.3.4 on Ubuntu 14.04 using Java(TM) SE Runtime Environment  
> (build 1.7.0\_55-b13)
> 
> Mike
> 
> On Thursday, August 21, 2014 11:51:37 AM UTC-6, Daniel Sarfati wrote:
> 
> > Hi all,
> > 
> > I'm trying to query for a particular subset of fields, one of which is a  
> > geo\_shape. All of the other fields are returned as expected, _aside from  
> > the geo shape_. Here is a trimmed-down version of my mapping:

--  
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/a7aa124e-a4fe-439c-b302-51b9f75dcdcd%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a7aa124e-a4fe-439c-b302-51b9f75dcdcd%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, 12:54am UTC](https://discuss.elastic.co/t/geo-shape-field-not-being-returned-with-explicit-fields-query/19397/4 "2017-07-06T00:54:02Z")

</div>


