Enabled _timestamp but don't see timestamp in document


(Jamshid) #1

I must be missing something from:

http://www.elasticsearch.org/guide/reference/mapping/timestamp-field.html

because I enable _timestamp but I don't see it returned in a search.

Is my mapping correct? How do I see the timestamp field?

curl -XDELETE http://localhost:9200/twitter
curl -XPUT http://localhost:9200/twitter
curl -XPUT http://localhost:9200/twitter/tweet/_mapping -d
'{ "tweet" : { "_timestamp" : { "enabled" : true, "store" :
true } } }'
curl -XPUT http://localhost:9200/twitter/tweet/8?timestamp=2009-11-15T14%3A12%3A12
-d '{ "user" : "kimchy", "message" : "trying out Elastic Search" }'
curl http://localhost:9200/twitter/tweet/8
...
{"_index":"twitter","_type":"tweet","_id":"8","_version":
1,"exists":true, "_source" : { "user" : "kimchy", "message" : "trying
out Elastic Search" }}

Thanks,
Jamshid


(Benjamin Dev├Ęze) #2

Hey Jamshid,

you have to explicit ask for the _timestamp fields to be returned so the
last call should be:

curl
'http://localhost:9200/twitter/tweet/8?pretty=1&fields=_source,_timestamp'

On Saturday, February 25, 2012 9:57:34 AM UTC+1, Jamshid wrote:

I must be missing something from:

http://www.elasticsearch.org/guide/reference/mapping/timestamp-field.html

because I enable _timestamp but I don't see it returned in a search.

Is my mapping correct? How do I see the timestamp field?

curl -XDELETE http://localhost:9200/twitter
curl -XPUT http://localhost:9200/twitter
curl -XPUT http://localhost:9200/twitter/tweet/_mapping -d
'{ "tweet" : { "_timestamp" : { "enabled" : true, "store" :
true } } }'
curl -XPUT http://localhost:9200/twitter/tweet/8?timestamp=2009-11-15T14%3A12%3A12

-dhttp://localhost:9200/twitter/tweet/8?timestamp=2009-11-15T14%3A12%3A12-d'{ "user" : "kimchy", "message" : "trying out Elastic Search" }'
curl http://localhost:9200/twitter/tweet/8
...
{"_index":"twitter","_type":"tweet","_id":"8","_version":
1,"exists":true, "_source" : { "user" : "kimchy", "message" : "trying
out Elastic Search" }}

Thanks,
Jamshid


(system) #3