Why is _timestamp not showing up in my query results?


(Shaunak Kashyap) #1

QUESTION

I have enabled the _timestamp field per http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-timestamp-field.html but I am not getting that field back in my query. What am I doing wrong?

ANSWER

Enabling _timestamp is the first part getting access to this field. The second part is you must explicitly reference in your query. For example:

curl 'http://localhost:9200/index/type/1?pretty=1&fields=_timestamp' 

This is common source of confusion.

Note: _timestamp is not the only field that is not shown by default by Elasticsearch. _ttl, _size, _parent and _routing are, also, not shown by default and need the help of "fields" attribute to make Elasticsearch return them, as well:

curl 'http://localhost:9200/index/type/1?pretty=1&fields=_timestamp,_ttl,_size,_parent,_routing' 

(system) #2