What's the timeunit of setTTL(long ttl) in IndexRequestBuilder?


(Daniel Guo) #1

I'm trying to set documents sent to elasticsearch with TTL in Java.

I call the method setTTL of IndexRequestBuilder when indexing documents.
But I don't know what the time unit and I cannot find in docs and api.

Could anybody helps, Thanks.

--
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/dd982469-3aca-4ede-b0ae-e564ce684c27%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Binh Ly) #2

It should be milliseconds.

--
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/fba8041e-a40a-4d73-af4a-a17f9241d602%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Daniel Guo) #3

@Binh, thank you, you are right, I find the reference here:
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/docs-index_.html#index-ttl

but the problem is that, the TTL doesn't work when indexing a document,
while it works when defined in type mapping. The user encountered the same
problem with me:

Actually I don't know why.

On Friday, February 21, 2014 9:38:44 PM UTC+8, Binh Ly wrote:

It should be milliseconds.

--
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/eab07716-d4ad-4266-aedc-3762c67fedb5%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Binh Ly) #4

That is correct, the _ttl field is disabled by default:

http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-ttl-field.html

To use TTL, you need to enable it first in the mapping and then after that
you can index documents with a TTL value and it will work as expected.

--
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/1c1a605f-779b-448b-bc48-d861fc24afb9%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Daniel Guo) #5

@Binh, enable ttl first in mapping and then use it in REST or client, it
make sense. Thank you again!

On Saturday, February 22, 2014 1:02:27 AM UTC+8, Binh Ly wrote:

That is correct, the _ttl field is disabled by default:

http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-ttl-field.html

To use TTL, you need to enable it first in the mapping and then after that
you can index documents with a TTL value and it will work as expected.

--
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/49d43974-4b9b-489d-b863-7ff4d9495746%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #6