为什么我不能看到_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