Problems with auto-_timestamp

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
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
{
"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
first java project ever) my search results look like:

$ curl 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"}
} ]
}
}

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/b5f08fc5-3eb9-48a5-a141-454e30e248c4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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
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
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
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
{
"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
first java project ever) my search results look like:

$ curl 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"}
} ]
}
}

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/4b33374b-5c14-451b-acb4-59ccd45e0fe9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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
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
{
"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
first java project ever) my search results look like:

$ curl 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"}
} ]
}
}

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! :slight_smile:

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

-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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/06994111-8931-4c60-a9f1-1eda3e26d15f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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
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
{
"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
first java project ever) my search results look like:

$ curl 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"}
} ]
}
}

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! :slight_smile:

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

-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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/aed34486-e7ea-4304-8889-ce5b40839d58%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.