# Dot field name when replacing "fields" parameter with "\_source"

**URL:** <https://discuss.elastic.co/t/dot-field-name-when-replacing-fields-parameter-with--source/22747>\
**Category:** Elasticsearch\
**Created:** [March 18, 2015, 7:12pm UTC](https://discuss.elastic.co/t/dot-field-name-when-replacing-fields-parameter-with--source/22747 "2015-03-18T19:12:14Z")\
**Posts on this page:** 2\
**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:** [March 18, 2015, 7:12pm UTC](https://discuss.elastic.co/t/dot-field-name-when-replacing-fields-parameter-with--source/22747/1 "2015-03-18T19:12:14Z")

</div>

Hello,

```
      1.x Elasticsearch now supports source filtering with "_source" 

```

parameter. Basically this will replace the behaviour of "fields" parameter  
in pre-1.x version (especially when fields data are not stored). Migrating  
to "\_source" is straightforward, however, I noticed one difference when  
returning a nested field:

- with "fields" in all versions of ES, a query  
{  
"query": {  
"match\_all": {}  
},  
"fields": "person.name"  
}

will return hits as:  
{...  
"fields": {  
"person.name": "Tom"  
}  
}

- with "\_source" in 1.x ES, a query  
{  
"query": {  
"match\_all": {}  
},  
"\_source": "person.name"  
}

will return hits as:  
{...  
"\_source": {  
"person": {  
"name": "Tom"  
}  
}  
}

I actually prefer the 2nd format, however, because we are migrating a web  
API to our end users, who might still expect the 1st format, I'd like to  
maintain the compatibility by giving users option to return nested fields  
using dot notation. I can probably do that transformation after ES queries,  
but I'm wondering if there is still a way to toggle the return format in ES  
directly.

Thanks,

Chunlei  
(BTW, I really enjoyed the first ElasticON, you guys did a wonderful job!)

Ref:  
[http://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-source-filtering.html](http://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-source-filtering.html)

--  
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/1060e36d-f60b-45d0-99d0-539ffe089269%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/1060e36d-f60b-45d0-99d0-539ffe089269%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:25am UTC](https://discuss.elastic.co/t/dot-field-name-when-replacing-fields-parameter-with--source/22747/2 "2017-07-06T00:25:44Z")

</div>


