# The "fields" option

**URL:** https://discuss.elastic.co/t/the-fields-option/3178
**Category:** Elasticsearch
**Created:** [August 1, 2010, 2:17am UTC](https://discuss.elastic.co/t/the-fields-option/3178 "2010-08-01T02:17:56Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![goodieboy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/goodieboy/32/3026_2.png) [@goodieboy](https://discuss.elastic.co/u/goodieboy)
#### Post date: [August 1, 2010, 2:17am UTC](https://discuss.elastic.co/t/the-fields-option/3178/1 "2010-08-01T02:17:56Z")

</div>

Hi,

I'm trying to set the return fields in my search request using the  
"fields" array. But nothing I do actually works:

"fields" : ["name", "location.city", "location.street"]

What am I missing here?

Thanks,  
Matt

---

<div class="post-metadata">

### Author: ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)
#### Post date: [August 1, 2010, 10:54am UTC](https://discuss.elastic.co/t/the-fields-option/3178/2 "2010-08-01T10:54:38Z")

</div>

You need to map them as stored in the mapping definition. In general, it is  
usually better to get back the actual json indexed and fetch what you want  
from them, then loading several fields.

-shay.banon

On Sun, Aug 1, 2010 at 5:17 AM, matt mitchell [goodieboy@gmail.com](mailto:goodieboy@gmail.com) wrote:

> Hi,
> 
> I'm trying to set the return fields in my search request using the  
> "fields" array. But nothing I do actually works:
> 
> "fields" : ["name", "location.city", "location.street"]
> 
> What am I missing here?
> 
> Thanks,  
> Matt

---

<div class="post-metadata">

### Author: ![goodieboy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/goodieboy/32/3026_2.png) [@goodieboy](https://discuss.elastic.co/u/goodieboy)
#### Post date: [August 1, 2010, 11:34am UTC](https://discuss.elastic.co/t/the-fields-option/3178/3 "2010-08-01T11:34:20Z")

</div>

Ahh yes, makes sense. Thanks.

Matt

On Aug 1, 6:54 am, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:

> You need to map them as stored in the mapping definition. In general, it is  
> usually better to get back the actual json indexed and fetch what you want  
> from them, then loading several fields.
> 
> -shay.banon
> 
> On Sun, Aug 1, 2010 at 5:17 AM, matt mitchell [goodie...@gmail.com](mailto:goodie...@gmail.com) wrote:
> 
> > Hi,
> 
> > I'm trying to set the return fields in my search request using the  
> > "fields" array. But nothing I do actually works:
> 
> > "fields" : ["name", "location.city", "location.street"]
> 
> > What am I missing here?
> 
> > Thanks,  
> > Matt

---

<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, 4:21am UTC](https://discuss.elastic.co/t/the-fields-option/3178/4 "2017-07-06T04:21:16Z")

</div>


