Hi, all.
We have an odd case where requesting explicit fields on a query sometimes
returns all the fields, and sometimes doesn't - for the same ids query
(i.e. for the same record). We haven't been able to nail it down - but it
usually works fine if we've just re-indexed and haven't yet shut down and
restarted ES, and usually doesn't work if we've shut down and restarted
ES.
We don't have any stored fields - everything is in the _source.
So - here's a CURL sample that sometimes returns the requested 'blob' field
and sometimes doesn't.
(I may mess up the formatting here - I'm using CURL on Windows, and taking
my original Windows command and morphing it into something more readable:
curl -XGET http://localhost:9200/cust1/_search?fields=blob -d '{
"query" : {
"ids" : {
"values" : ["ent://SD_ASSET/0/122"]
}
}
}'
When it DOES NOT return the blob field, here's the resulting JSON:
{ "_shards" : { "failed" : 0,
"successful" : 1,
"total" : 1
},
"hits" : { "hits" : [ { "_id" : "ent://SD_ASSET/0/122",
"_index" : "cust1",
"_score" : 1.0,
"_type" : "sd_asset"
} ],
"max_score" : 1.0,
"total" : 1
},
"timed_out" : false,
"took" : 1
}
When it DOES return the blob field, here's the resulting JSON:
{ "_shards" : { "failed" : 0,
"successful" : 1,
"total" : 1
},
"hits" : { "hits" : [ { "_id" : "ent://SD_ASSET/0/122",
"_index" : "cust1",
"_score" : 1.0,
"_type" : "sd_asset",
"fields" : { "_source.blob" :
"H4sIAAAAAAAAAJ3UUWvDIBAA4L/Sx+1lLun2UJAQMVcqTTSorGQvEhrXBUwGW7Pfv3QZY82KBZ+8Qz8PzkPcvO2HzvbHBLdNEsUxRuOKu/q4f53SKcQvrXXjRl93NtlCtRMyUxh9p/izdoNN+sE5jKYYo5/zf5kEpSWjmgk+o2kKRamrNPV6QikoZXJ4gvzcR4EuDnTLQPfgdWshC6LPBVEK9JWujoUIp2CUkDO98krKNHsGrjasDHoPmgORp8qzpt6HqCAUBanVlbZcVo9exAEyo4XZcrELamYBGSNGV+WsrBF6A9L4B+40JIaTYmaVfW9r97E4DG1jFzfLu+j23z3o9wP4AlqyXlULBAAA"
}
} ],
"max_score" : 1.0,
"total" : 1
},
"timed_out" : false,
"took" : 2
}
If I don't ask for any fields, here's the response (just to show you what's
in the _source)
{ "_shards" : { "failed" : 0,
"successful" : 1,
"total" : 1
},
"hits" : { "hits" : [ { "_id" : "ent://SD_ASSET/0/122",
"_index" : "cust1",
"_score" : 1.0,
"_source" : { "ACCESS_LEVEL_nfacet" : [ "1",
"2",
"3",
"4"
],
"ASSET_NAME_display" : [ "Serials guide (3.1)" ],
"CITIZENSHIPS_facet" : [ "@@EMPTY@@" ],
"CLEARANCE_nfacet" : [ "20",
"0",
"10",
"99",
"5"
],
"DOC_TEXT" : [ "null",
"ASSET",
"OTHER",
"Serials guide (3.1)"
],
"DS_EC" : "SD_ASSET",
"DS_KEY" : 7,
"FORMAT_display" : [ "ASSET" ],
"FORMAT_facet" : [ "ASSET" ],
"KEYWORDS_display" : [ "null" ],
"KEYWORDS_facet" : [ "null" ],
"MEDIA_TYPE_display" : [ "OTHER" ],
"MEDIA_TYPE_facet" : [ "OTHER" ],
"NEED_TO_KNOWS_facet" : [ "@@EMPTY@@" ],
"RELEVANCE_SORT_nsort" : "9",
"RESTRICTIONS_facet" : [ "@@EMPTY@@" ],
"_id" : "ent://SD_ASSET/0/122",
"blob" :
"H4sIAAAAAAAAAJ3UUWvDIBAA4L/Sx+1lLun2UJAQMVcqTTSorGQvEhrXBUwGW7Pfv3QZY82KBZ+8Qz8PzkPcvO2HzvbHBLdNEsUxRuOKu/q4f53SKcQvrXXjRl93NtlCtRMyUxh9p/izdoNN+sE5jKYYo5/zf5kEpSWjmgk+o2kKRamrNPV6QikoZXJ4gvzcR4EuDnTLQPfgdWshC6LPBVEK9JWujoUIp2CUkDO98krKNHsGrjasDHoPmgORp8qzpt6HqCAUBanVlbZcVo9exAEyo4XZcrELamYBGSNGV+WsrBF6A9L4B+40JIaTYmaVfW9r97E4DG1jFzfLu+j23z3o9wP4AlqyXlULBAAA",
"sequence" : 4
},
"_type" : "sd_asset"
} ],
"max_score" : 1.0,
"total" : 1
},
"timed_out" : false,
"took" : 1
}
Anyways - this is a sort of minimal example. What we're really seeing is
on a request for 6 fields to be returned, sometimes we get all 6, sometimes
we just get one or two.
I know that we can modify the query to prefix all the field names by
"_source.", and that does indeed consistently return all the requested
fields. But, since my understanding is that when requesting fields just by
name, they should be returned from the _source without needing that
qualifier.
Any ideas if this is a bug? I looked through the archives and found one
that's similar, but not identical:
https://groups.google.com/forum/?fromgroups#!searchin/elasticsearch/fields$20not$20returned/elasticsearch/z_Er_Q1N1yw/tWb1JfvuaHUJ
(That's where I found the idea of qualifying the field names)
I've attached the index meta data if that is of any help.
Thanks!
Bob.
--
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.
For more options, visit https://groups.google.com/groups/opt_out.