# Getting all fields by "fileds" : "\*"

**URL:** <https://discuss.elastic.co/t/getting-all-fields-by-fileds/20393>\
**Category:** Elasticsearch\
**Created:** [October 23, 2014, 6:22am UTC](https://discuss.elastic.co/t/getting-all-fields-by-fileds/20393 "2014-10-23T06:22:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gargoyle\_2](https://avatars.discourse-cdn.com/v4/letter/g/ce7236/32.png) [@Gargoyle\_2](https://discuss.elastic.co/u/Gargoyle_2)\
**Post date:** [October 23, 2014, 6:22am UTC](https://discuss.elastic.co/t/getting-all-fields-by-fileds/20393/1 "2014-10-23T06:22:41Z")

</div>

Hi,

would anyone have an idea, why my queries with "fields" : "\*" return no  
fields? All string fields are "not\_analyzed".

I.e. query:

{  
"size" : 1,  
"fields" : "\*",  
"query": {  
"match\_all" : {}  
}  
}

returns

{  
"took": 81,  
"timed\_out": false,  
"\_shards": {  
"total": 40,  
"successful": 40,  
"failed": 0  
},  
"hits": {  
"total": 39806726,  
"max\_score": 1,  
"hits": [  
{  
"\_index": "zperf\_2014-10-16",  
"\_type": "sample",  
"\_id": "1VMDom\_uQSeMEDSt\_aFyNw",  
"\_score": 1  
}  
]  
}  
}

while if I'm not specifying "fields" at all, I get the \_source as expected:

{  
"took": 75,  
"timed\_out": false,  
"\_shards": {  
"total": 40,  
"successful": 40,  
"failed": 0  
},  
"hits": {  
"total": 39806726,  
"max\_score": 1,  
"hits": [  
{  
"\_index": "zperf\_2014-10-16",  
"\_type": "sample",  
"\_id": "1VMDom\_uQSeMEDSt\_aFyNw",  
"\_score": 1,  
"\_source": {  
"timestamp": "2014-10-16T17:38:20.000Z",  
"path2": "VM",  
"path1": "vSphere11",  
"path4": "scsi0:0",  
"path3": "vm-3276",  
"virtualDisk.numberWriteAveraged": 0,  
"virtualDisk.numberReadAveraged": 0,  
"vmName": null  
}  
}  
]  
}  
}

and I I'm specific on fields like this:

{  
"size" : 1,  
"fields" : ["timestamp", "path3"],  
"query": {  
"match\_all" : {}  
}  
}

I'm getting what I wanted:

{  
"took": 78,  
"timed\_out": false,  
"\_shards": {  
"total": 40,  
"successful": 40,  
"failed": 0  
},  
"hits": {  
"total": 39836795,  
"max\_score": 1,  
"hits": [  
{  
"\_index": "zperf\_2014-10-16",  
"\_type": "sample",  
"\_id": "1VMDom\_uQSeMEDSt\_aFyNw",  
"\_score": 1,  
"fields": {  
"timestamp": [  
"2014-10-16T17:38:20.000Z"  
],  
"path3": [  
"vm-3276"  
]  
}  
}  
]  
}  
}

--  
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/9be8798b-4824-4e02-974c-b333ec8792b1%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/9be8798b-4824-4e02-974c-b333ec8792b1%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Tanguy\_Leroux](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tanguy_leroux/32/121066_2.png) [@Tanguy\_Leroux](https://discuss.elastic.co/u/Tanguy_Leroux)\
**Post date:** [October 23, 2014, 2:33pm UTC](https://discuss.elastic.co/t/getting-all-fields-by-fileds/20393/2 "2014-10-23T14:33:15Z")

</div>

The documentation (see  
[Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-fields.html#search-request-fields))  
says that \* can be used to load all stored fields from the document.

If your mapping doesn't define stored field then '\*' works as if you had  
specified an empty array and only \_id / \_type / \_index fields are returned  
for each hit.

-- Tanguy

Le jeudi 23 octobre 2014 08:22:42 UTC+2, Gargoyle a écrit :

> Hi,
> 
> would anyone have an idea, why my queries with "fields" : "\*" return no  
> fields? All string fields are "not\_analyzed".
> 
> I.e. query:
> 
> {  
> "size" : 1,  
> "fields" : "\*",  
> "query": {  
> "match\_all" : {}  
> }  
> }
> 
> returns
> 
> {  
> "took": 81,  
> "timed\_out": false,  
> "\_shards": {  
> "total": 40,  
> "successful": 40,  
> "failed": 0  
> },  
> "hits": {  
> "total": 39806726,  
> "max\_score": 1,  
> "hits": [  
> {  
> "\_index": "zperf\_2014-10-16",  
> "\_type": "sample",  
> "\_id": "1VMDom\_uQSeMEDSt\_aFyNw",  
> "\_score": 1  
> }  
> ]  
> }  
> }
> 
> while if I'm not specifying "fields" at all, I get the \_source as expected:
> 
> {  
> "took": 75,  
> "timed\_out": false,  
> "\_shards": {  
> "total": 40,  
> "successful": 40,  
> "failed": 0  
> },  
> "hits": {  
> "total": 39806726,  
> "max\_score": 1,  
> "hits": [  
> {  
> "\_index": "zperf\_2014-10-16",  
> "\_type": "sample",  
> "\_id": "1VMDom\_uQSeMEDSt\_aFyNw",  
> "\_score": 1,  
> "\_source": {  
> "timestamp": "2014-10-16T17:38:20.000Z",  
> "path2": "VM",  
> "path1": "vSphere11",  
> "path4": "scsi0:0",  
> "path3": "vm-3276",  
> "virtualDisk.numberWriteAveraged": 0,  
> "virtualDisk.numberReadAveraged": 0,  
> "vmName": null  
> }  
> }  
> ]  
> }  
> }
> 
> and I I'm specific on fields like this:
> 
> {  
> "size" : 1,  
> "fields" : ["timestamp", "path3"],  
> "query": {  
> "match\_all" : {}  
> }  
> }
> 
> I'm getting what I wanted:
> 
> {  
> "took": 78,  
> "timed\_out": false,  
> "\_shards": {  
> "total": 40,  
> "successful": 40,  
> "failed": 0  
> },  
> "hits": {  
> "total": 39836795,  
> "max\_score": 1,  
> "hits": [  
> {  
> "\_index": "zperf\_2014-10-16",  
> "\_type": "sample",  
> "\_id": "1VMDom\_uQSeMEDSt\_aFyNw",  
> "\_score": 1,  
> "fields": {  
> "timestamp": [  
> "2014-10-16T17:38:20.000Z"  
> ],  
> "path3": [  
> "vm-3276"  
> ]  
> }  
> }  
> ]  
> }  
> }

--  
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/029cee19-2f28-444c-af38-a47a05e0d5ec%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/029cee19-2f28-444c-af38-a47a05e0d5ec%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/getting-all-fields-by-fileds/20393/3 "2017-07-06T00:54:13Z")

</div>


