Elasticsearch 1.5 不会添加_timestamp

Elasticsearch 1.5 Won't Add _timestamp

我在创建索引时使用了这个请求:

PUT some_name
{
  "mappings": {
    "_default_": {
      "_timestamp" : {
        "enabled": true,
        "store": true
      },
      "properties": {
        "properties": {
          "properties": {
            "location": {
              "type": "geo_point"
            }
          }
        }
      }
    }
  }
}

但是,基本上当我添加一个文档(没有任何时间字段)并请求返回时,_timestamp 字段没有被返回。我是运行 Elasticsearch 1.5,试过"store": "yes""store": "true"

我做错了什么?谢谢

您需要特别要求返回该字段:"fields": ["_timestamp"] 因为它是一个不常返回的字段,并且不包含在 _source 中(默认返回):

GET /some_name/_search
{
  "query": {
    "match_all": {}
  },
  "fields": ["_timestamp"]
}