# "fields" parameter with dot notation

**URL:** <https://discuss.elastic.co/t/fields-parameter-with-dot-notation/12213>\
**Category:** Elasticsearch\
**Created:** [May 31, 2013, 9:27pm UTC](https://discuss.elastic.co/t/fields-parameter-with-dot-notation/12213 "2013-05-31T21:27:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chunlei\_Wu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chunlei_wu/32/824_2.png) [@Chunlei\_Wu](https://discuss.elastic.co/u/Chunlei_Wu)\
**Post date:** [May 31, 2013, 9:27pm UTC](https://discuss.elastic.co/t/fields-parameter-with-dot-notation/12213/1 "2013-05-31T21:27:12Z")

</div>

Hi,

```
      Elasticsearch's search API supports a "fields" parameter to limit 

```

the fields returned from the hits. It supports dot notation for  
sub-properties of a document as well. For example, a query

{  
"fields" : ["user.lastname"],  
"query" : {  
"term" : { "\_id" : 1 }  
}  
}

will return hits as:

{  
"hits": [  
{"\_id": 1,  
"user.lastname": "Smith"}  
]  
}

I am wondering if there is an option to make it return as this instead:  
{  
"hits": [  
{"\_id": 1,  
"user": {"lastname": "Smith"}}  
]  
}

The benefit of the second one is maintaining the same structure as the full  
document, as that the following data access logic is consistent.

Is it a reasonable feature request?

Chunlei

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Chunlei\_Wu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chunlei_wu/32/824_2.png) [@Chunlei\_Wu](https://discuss.elastic.co/u/Chunlei_Wu)\
**Post date:** [June 20, 2013, 4:50pm UTC](https://discuss.elastic.co/t/fields-parameter-with-dot-notation/12213/2 "2013-06-20T16:50:13Z")

</div>

Any comment on why the current behavior is chosen not the other? Thanks.

On Friday, May 31, 2013 2:27:12 PM UTC-7, Chunlei Wu wrote:

> Hi,
> 
> ```
> Elasticsearch's search API supports a "fields" parameter to 
> 
> ```
> 
> limit the fields returned from the hits. It supports dot notation for  
> sub-properties of a document as well. For example, a query
> 
> {  
> "fields" : ["user.lastname"],  
> "query" : {  
> "term" : { "\_id" : 1 }  
> }  
> }
> 
> will return hits as:
> 
> {  
> "hits": [  
> {"\_id": 1,  
> "user.lastname": "Smith"}  
> ]  
> }
> 
> I am wondering if there is an option to make it return as this instead:  
> {  
> "hits": [  
> {"\_id": 1,  
> "user": {"lastname": "Smith"}}  
> ]  
> }
> 
> The benefit of the second one is maintaining the same structure as the  
> full document, as that the following data access logic is consistent.
> 
> Is it a reasonable feature request?
> 
> Chunlei

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:30am UTC](https://discuss.elastic.co/t/fields-parameter-with-dot-notation/12213/3 "2017-07-06T02:30:10Z")

</div>


