# Problems with auto-\_timestamp

**URL:** <https://discuss.elastic.co/t/problems-with-auto--timestamp/20255>\
**Category:** Elasticsearch\
**Created:** [October 15, 2014, 12:46am UTC](https://discuss.elastic.co/t/problems-with-auto--timestamp/20255 "2014-10-15T00:46:10Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joshua\_Holbrook](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joshua_holbrook/32/1198_2.png) [@Joshua\_Holbrook](https://discuss.elastic.co/u/Joshua_Holbrook)\
**Post date:** [October 15, 2014, 12:46am UTC](https://discuss.elastic.co/t/problems-with-auto--timestamp/20255/1 "2014-10-15T00:46:10Z")

</div>

Hello,

I'm working on an irc bot that indexes in-channel image links, and so far  
so good---except I can't seem to get automatic timestamps working! I did my  
best to follow the docs at  
[http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-timestamp-field.html](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-timestamp-field.html)  
but I don't see any change in what my search docs look like, even after  
deleting the entire index and reconfiguring first.

Right now my mapping looks like this:

$ curl [http://localhost:9200/archivist/\_mapping?pretty](http://localhost:9200/archivist/_mapping?pretty)  
{  
"archivist" : {  
"mappings" : {  
"image" : {  
"\_timestamp" : {  
"enabled" : true,  
"store" : true  
},  
"properties" : {  
"channel" : {  
"type" : "string"  
},  
"image" : {  
"type" : "string"  
},  
"message" : {  
"type" : "string"  
},  
"user" : {  
"type" : "string"  
}  
}  
}  
}  
}  
}

and after indexing something (code doing this at  
[https://github.com/jesusabdullah/archivist/blob/master/src/main/java/com/jesusabdullah/archivist/Indexer.java#L71-L82](https://github.com/jesusabdullah/archivist/blob/master/src/main/java/com/jesusabdullah/archivist/Indexer.java#L71-L82)  
first java project ever) my search results look like:

$ curl [http://localhost:9200/archivist/image/\_search?pretty](http://localhost:9200/archivist/image/_search?pretty)  
{  
"took" : 0,  
"timed\_out" : false,  
"\_shards" : {  
"total" : 5,  
"successful" : 5,  
"failed" : 0  
},  
"hits" : {  
"total" : 1,  
"max\_score" : 1.0,  
"hits" : [ {  
"\_index" : "archivist",  
"\_type" : "image",  
"\_id" : "jK8dY6oKTRifbUU4o406pw",  
"\_score" : 1.0,

"\_source":{"channel":"#nodebombrange","user":"jesusabdullah","message":"snoop!  
[http://i.imgur.com/iktO9TK.gif","image":"http://i.imgur.com/iktO9TK.gif](http://i.imgur.com/iktO9TK.gif%22,%22image%22:%22http://i.imgur.com/iktO9TK.gif)"}  
} ]  
}  
}

Am I doing something wrong?

Thanks,

--Josh

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/b5f08fc5-3eb9-48a5-a141-454e30e248c4%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/b5f08fc5-3eb9-48a5-a141-454e30e248c4%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Joshua\_Holbrook](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joshua_holbrook/32/1198_2.png) [@Joshua\_Holbrook](https://discuss.elastic.co/u/Joshua_Holbrook)\
**Post date:** [October 15, 2014, 7:34pm UTC](https://discuss.elastic.co/t/problems-with-auto--timestamp/20255/2 "2014-10-15T19:34:23Z")

</div>

Update:

I did some digging and discovered the setTimestamp method  
[https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/action/index/IndexRequestBuilder.java#L297-L303](https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/action/index/IndexRequestBuilder.java#L297-L303)  
so I tried adding that to my code  
[https://github.com/jesusabdullah/zoltun/blob/master/src/main/java/com/jesusabdullah/zoltun/Indexer.java#L83-L85](https://github.com/jesusabdullah/zoltun/blob/master/src/main/java/com/jesusabdullah/zoltun/Indexer.java#L83-L85)  
but this doesn't appear to have done the trick either.

I suspect my problems are coming from using the java api, which uses the  
tcp node-to-node communication protocol instead of the typical http/json  
one.

--Josh

On Tuesday, October 14, 2014 8:46:10 PM UTC-4, Joshua Holbrook wrote:

> Hello,
> 
> I'm working on an irc bot that indexes in-channel image links, and so far  
> so good---except I can't seem to get automatic timestamps working! I did my  
> best to follow the docs at  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-timestamp-field.html)  
> but I don't see any change in what my search docs look like, even after  
> deleting the entire index and reconfiguring first.
> 
> Right now my mapping looks like this:
> 
> $ curl [http://localhost:9200/archivist/\_mapping?pretty](http://localhost:9200/archivist/_mapping?pretty)  
> {  
> "archivist" : {  
> "mappings" : {  
> "image" : {  
> "\_timestamp" : {  
> "enabled" : true,  
> "store" : true  
> },  
> "properties" : {  
> "channel" : {  
> "type" : "string"  
> },  
> "image" : {  
> "type" : "string"  
> },  
> "message" : {  
> "type" : "string"  
> },  
> "user" : {  
> "type" : "string"  
> }  
> }  
> }  
> }  
> }  
> }
> 
> and after indexing something (code doing this at  
> [https://github.com/jesusabdullah/archivist/blob/master/src/main/java/com/jesusabdullah/archivist/Indexer.java#L71-L82](https://github.com/jesusabdullah/archivist/blob/master/src/main/java/com/jesusabdullah/archivist/Indexer.java#L71-L82)  
> first java project ever) my search results look like:
> 
> $ curl [http://localhost:9200/archivist/image/\_search?pretty](http://localhost:9200/archivist/image/_search?pretty)  
> {  
> "took" : 0,  
> "timed\_out" : false,  
> "\_shards" : {  
> "total" : 5,  
> "successful" : 5,  
> "failed" : 0  
> },  
> "hits" : {  
> "total" : 1,  
> "max\_score" : 1.0,  
> "hits" : [ {  
> "\_index" : "archivist",  
> "\_type" : "image",  
> "\_id" : "jK8dY6oKTRifbUU4o406pw",  
> "\_score" : 1.0,
> 
> "\_source":{"channel":"#nodebombrange","user":"jesusabdullah","message":"snoop!  
> [http://i.imgur.com/iktO9TK.gif","image":"http://i.imgur.com/iktO9TK.gif](http://i.imgur.com/iktO9TK.gif%22,%22image%22:%22http://i.imgur.com/iktO9TK.gif)"}  
> } ]  
> }  
> }
> 
> Am I doing something wrong?
> 
> Thanks,
> 
> --Josh

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/4b33374b-5c14-451b-acb4-59ccd45e0fe9%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/4b33374b-5c14-451b-acb4-59ccd45e0fe9%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![jordansissel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jordansissel/32/44957_2.png) [@jordansissel](https://discuss.elastic.co/u/jordansissel)\
**Post date:** [October 16, 2014, 12:07am UTC](https://discuss.elastic.co/t/problems-with-auto--timestamp/20255/3 "2014-10-16T00:07:30Z")

</div>

On Tuesday, October 14, 2014 5:46:10 PM UTC-7, Joshua Holbrook wrote:

> Hello,
> 
> I'm working on an irc bot that indexes in-channel image links, and so far  
> so good---except I can't seem to get automatic timestamps working! I did my  
> best to follow the docs at  
> [Elastic — The Search AI Company | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-timestamp-field.html)  
> but I don't see any change in what my search docs look like, even after  
> deleting the entire index and reconfiguring first.
> 
> Right now my mapping looks like this:
> 
> $ curl [http://localhost:9200/archivist/\_mapping?pretty](http://localhost:9200/archivist/_mapping?pretty)  
> {  
> "archivist" : {  
> "mappings" : {  
> "image" : {  
> "\_timestamp" : {  
> "enabled" : true,  
> "store" : true  
> },  
> "properties" : {  
> "channel" : {  
> "type" : "string"  
> },  
> "image" : {  
> "type" : "string"  
> },  
> "message" : {  
> "type" : "string"  
> },  
> "user" : {  
> "type" : "string"  
> }  
> }  
> }  
> }  
> }  
> }
> 
> and after indexing something (code doing this at  
> [https://github.com/jesusabdullah/archivist/blob/master/src/main/java/com/jesusabdullah/archivist/Indexer.java#L71-L82](https://github.com/jesusabdullah/archivist/blob/master/src/main/java/com/jesusabdullah/archivist/Indexer.java#L71-L82)  
> first java project ever) my search results look like:
> 
> $ curl [http://localhost:9200/archivist/image/\_search?pretty](http://localhost:9200/archivist/image/_search?pretty)  
> {  
> "took" : 0,  
> "timed\_out" : false,  
> "\_shards" : {  
> "total" : 5,  
> "successful" : 5,  
> "failed" : 0  
> },  
> "hits" : {  
> "total" : 1,  
> "max\_score" : 1.0,  
> "hits" : [ {  
> "\_index" : "archivist",  
> "\_type" : "image",  
> "\_id" : "jK8dY6oKTRifbUU4o406pw",  
> "\_score" : 1.0,
> 
> "\_source":{"channel":"#nodebombrange","user":"jesusabdullah","message":"snoop!  
> [#puffpuffpasstuesdays - GIF on Imgur](http://i.imgur.com/iktO9TK.gif%22,%22image%22:%22http://i.imgur.com/iktO9TK.gif)"}  
> } ]  
> }  
> }
> 
> Am I doing something wrong?

This was also confusing to me at first. I asked my coworkers who gave me a  
good answer and also was pointed at a useful answer on the mailing list -  
so between you and me and some other folks asking questions, you aren't  
alone in your confusion! 🙂

The short answer is that you must request \_timestamp being returned to you:

# Here, I ask for \_source and \_timestamp to be shown to me:

% curl 'localhost:9200/archivist/\_search?pretty&fields=\_timestamp,\_source'  
{  
"took" : 1,  
"timed\_out" : false,  
"\_shards" : {  
"total" : 5,  
"successful" : 5,  
"failed" : 0  
},  
"hits" : {  
"total" : 1,  
"max\_score" : 1.0,  
"hits" : [ {  
"\_index" : "archivist",  
"\_type" : "image",  
"\_id" : "jUWknMq1RmusrlU6hP2BGw",  
"\_score" : 1.0,  
"\_source": { "fancy": "pants whoa"},  
"fields" : {  
"\_timestamp" : 1413417808235  
}  
} ]  
}  
}

This post has the more detailed answer:  
[https://groups.google.com/forum/#!msg/elasticsearch/pebxC9ezowg/XCXH-POYvuQJ](https://groups.google.com/forum/#!msg/elasticsearch/pebxC9ezowg/XCXH-POYvuQJ)

-Jordan

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/06994111-8931-4c60-a9f1-1eda3e26d15f%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/06994111-8931-4c60-a9f1-1eda3e26d15f%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Joshua\_Holbrook](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joshua_holbrook/32/1198_2.png) [@Joshua\_Holbrook](https://discuss.elastic.co/u/Joshua_Holbrook)\
**Post date:** [October 16, 2014, 12:39am UTC](https://discuss.elastic.co/t/problems-with-auto--timestamp/20255/4 "2014-10-16T00:39:11Z")

</div>

This works for me. I thought I was actually going crazy. XD Thanks a bunch  
Jordan!

--Josh

On Wednesday, October 15, 2014 8:07:31 PM UTC-4, Jordan Sissel wrote:

> On Tuesday, October 14, 2014 5:46:10 PM UTC-7, Joshua Holbrook wrote:
> 
> > Hello,
> > 
> > I'm working on an irc bot that indexes in-channel image links, and so far  
> > so good---except I can't seem to get automatic timestamps working! I did my  
> > best to follow the docs at  
> > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-timestamp-field.html)  
> > but I don't see any change in what my search docs look like, even after  
> > deleting the entire index and reconfiguring first.
> > 
> > Right now my mapping looks like this:
> > 
> > $ curl [http://localhost:9200/archivist/\_mapping?pretty](http://localhost:9200/archivist/_mapping?pretty)  
> > {  
> > "archivist" : {  
> > "mappings" : {  
> > "image" : {  
> > "\_timestamp" : {  
> > "enabled" : true,  
> > "store" : true  
> > },  
> > "properties" : {  
> > "channel" : {  
> > "type" : "string"  
> > },  
> > "image" : {  
> > "type" : "string"  
> > },  
> > "message" : {  
> > "type" : "string"  
> > },  
> > "user" : {  
> > "type" : "string"  
> > }  
> > }  
> > }  
> > }  
> > }  
> > }
> > 
> > and after indexing something (code doing this at  
> > [https://github.com/jesusabdullah/archivist/blob/master/src/main/java/com/jesusabdullah/archivist/Indexer.java#L71-L82](https://github.com/jesusabdullah/archivist/blob/master/src/main/java/com/jesusabdullah/archivist/Indexer.java#L71-L82)  
> > first java project ever) my search results look like:
> > 
> > $ curl [http://localhost:9200/archivist/image/\_search?pretty](http://localhost:9200/archivist/image/_search?pretty)  
> > {  
> > "took" : 0,  
> > "timed\_out" : false,  
> > "\_shards" : {  
> > "total" : 5,  
> > "successful" : 5,  
> > "failed" : 0  
> > },  
> > "hits" : {  
> > "total" : 1,  
> > "max\_score" : 1.0,  
> > "hits" : [ {  
> > "\_index" : "archivist",  
> > "\_type" : "image",  
> > "\_id" : "jK8dY6oKTRifbUU4o406pw",  
> > "\_score" : 1.0,
> > 
> > "\_source":{"channel":"#nodebombrange","user":"jesusabdullah","message":"snoop!  
> > [http://i.imgur.com/iktO9TK.gif","image":"http://i.imgur.com/iktO9TK.gif](http://i.imgur.com/iktO9TK.gif%22,%22image%22:%22http://i.imgur.com/iktO9TK.gif)"}  
> > } ]  
> > }  
> > }
> > 
> > Am I doing something wrong?
> 
> This was also confusing to me at first. I asked my coworkers who gave me a  
> good answer and also was pointed at a useful answer on the mailing list -  
> so between you and me and some other folks asking questions, you aren't  
> alone in your confusion! 🙂
> 
> The short answer is that you must request \_timestamp being returned to you:
> 
> # Here, I ask for \_source and \_timestamp to be shown to me:
> 
> % curl 'localhost:9200/archivist/\_search?pretty&fields=\_timestamp,\_source'  
> {  
> "took" : 1,  
> "timed\_out" : false,  
> "\_shards" : {  
> "total" : 5,  
> "successful" : 5,  
> "failed" : 0  
> },  
> "hits" : {  
> "total" : 1,  
> "max\_score" : 1.0,  
> "hits" : [ {  
> "\_index" : "archivist",  
> "\_type" : "image",  
> "\_id" : "jUWknMq1RmusrlU6hP2BGw",  
> "\_score" : 1.0,  
> "\_source": { "fancy": "pants whoa"},  
> "fields" : {  
> "\_timestamp" : 1413417808235  
> }  
> } ]  
> }  
> }
> 
> This post has the more detailed answer:
> 
> [Redirecting to Google Groups](https://groups.google.com/forum/#!msg/elasticsearch/pebxC9ezowg/XCXH-POYvuQJ)
> 
> -Jordan

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/aed34486-e7ea-4304-8889-ce5b40839d58%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/aed34486-e7ea-4304-8889-ce5b40839d58%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 12:55am UTC](https://discuss.elastic.co/t/problems-with-auto--timestamp/20255/5 "2017-07-06T00:55:55Z")

</div>


