Getting all fields by "fileds" : "*"

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/9be8798b-4824-4e02-974c-b333ec8792b1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

The documentation (see
Elasticsearch Platform — Find real-time answers at scale | Elastic)
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/029cee19-2f28-444c-af38-a47a05e0d5ec%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.