Hasan Can Saral
Hasan Can Saral

Reputation: 3288

Elasticsearch 1.5 Won't Add _timestamp

I am using this request when creating my index:

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

However, _timestamp field is not being returned, basically when I add a document (without any time field) and request it back. I am running Elasticsearch 1.5, and I have tried "store": "yes", "store": "true".

What am I doing wrong? Thanks.

Upvotes: 0

Views: 63

Answers (1)

Andrei Stefan
Andrei Stefan

Reputation: 52368

You need to specifically ask for that field to be returned: "fields": ["_timestamp"] because it's a field that's not commonly returned and is not included in the _source (the default being returned):

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

Upvotes: 1

Related Questions