爲什麼我不能看到_timestamp字段,同時能夠通過它過濾查詢?返回elasticsearch中的時間戳字段
以下查詢返回正確的文檔,但不是時間戳本身。我怎樣才能返回時間戳?
{
"fields": [
"_timestamp",
"_source"
],
"query": {
"filtered": {
"query": {
"match_all": {}
},
"filter": {
"range": {
"_timestamp": {
"from": "2013-01-01"
}
}
}
}
}
}
的映射是:
{
"my_doctype": {
"_timestamp": {
"enabled": "true"
},
"properties": {
"cards": {
"type": "integer"
}
}
}
}
輸出樣本:
{
"took" : 1,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"failed" : 0
},
"hits" : {
"total" : 2,
"max_score" : 1.0,
"hits" : [ {
"_index" : "test1",
"_type" : "doctype1",
"_id" : "HjfryYQEQL6RkEX3VOiBHQ",
"_score" : 1.0, "_source" : {"cards": "5"}
}, {
"_index" : "test1",
"_type" : "doctype1",
"_id" : "sDyHcT1BTMatjmUS0NSoEg",
"_score" : 1.0, "_source" : {"cards": "2"}
}]
}
謝謝。 作爲一個旁註,如果我現在在現有索引上更新我的映射,新記錄是否將存儲時間戳記存儲爲舊時間?還是會將舊記錄存儲起來? – eran 2013-03-28 07:10:41
您將無法在現有類型上更新此映射。 _timestamp映射只能在創建類型時設置。 – imotov 2013-03-28 10:14:32