Can't get ttl to work

Going out of my brain trying to get ttl to work! Here are my current
settings. Note that I have tried both _ttl and ttl in the settings below:

{

  • domains:
    {
    • settings:
      {
      • index.analysis.analyzer.standard.type: "standard",
      • index.analysis.analyzer.default.stopwords.0: "_no_stop_words",
      • index.mappings.public.properties.list.all.type: "nested",
      • index.mappings.user.properties.list.all.type: "nested",
      • index.source.compress: "true",
      • index.source.enabled: "true",
      • index.merge.policy.merge_factor: "3",
      • index.mappings.public._ttl.enabled: "true",
      • index.analysis.analyzer.default.type: "standard",
      • index.mappings.public._timestamp.enabled: "true",
      • index.number_of_shards: "5",
      • index.number_of_replicas: "1",
      • index.version.created: "190299"
        }
        }

}

in addition I have tried this http://....../domains/public/_mapping with *
PUT* and a request body of: {"public":{"ttl":{"enabled":true}}}

Again, I have tried both ttl and _ttl in the mapping request body. When am
I supposed to use underscores and when am I not? I can't quite get a handle
on that.

After trying to set the ttl mapping, calling _settings on public doesn't
show the actual ttl value I set, suggesting I either set it incorrectly or
the ttl value is hidden:

{

  • public:
    {
    • properties:
      {
      • foo:
        {
        • type: "string"
          }
          }
          }

}

I've tried setting ttl in the document using the querystring: ?ttl=30s
And in the json body: { "foo":"bar", "_ttl":"30s" }
Just in case "30s" was wrong, I've also tried using 30000 (milliseconds).

Nothing I do causes the document to expire. What am I doing wrong?

never mind, I got it to work.

On Monday, April 23, 2012 8:38:06 PM UTC+1, Nathan Ridley wrote:

Going out of my brain trying to get ttl to work! Here are my current
settings. Note that I have tried both _ttl and ttl in the settings below:

{

  • domains:
    {
    • settings:
      {
      • index.analysis.analyzer.standard.type: "standard",
      • index.analysis.analyzer.default.stopwords.0: "_no_stop_words",
      • index.mappings.public.properties.list.all.type: "nested",
      • index.mappings.user.properties.list.all.type: "nested",
      • index.source.compress: "true",
      • index.source.enabled: "true",
      • index.merge.policy.merge_factor: "3",
      • index.mappings.public._ttl.enabled: "true",
      • index.analysis.analyzer.default.type: "standard",
      • index.mappings.public._timestamp.enabled: "true",
      • index.number_of_shards: "5",
      • index.number_of_replicas: "1",
      • index.version.created: "190299"
        }
        }

}

in addition I have tried this http://....../domains/public/_mapping with
PUT and a request body of: {"public":{"ttl":{"enabled":true}}}

Again, I have tried both ttl and _ttl in the mapping request body. When am
I supposed to use underscores and when am I not? I can't quite get a handle
on that.

After trying to set the ttl mapping, calling _settings on public doesn't
show the actual ttl value I set, suggesting I either set it incorrectly or
the ttl value is hidden:

{

  • public:
    {
    • properties:
      {
      • foo:
        {
        • type: "string"
          }
          }
          }

}

I've tried setting ttl in the document using the querystring: ?ttl=30s
And in the json body: { "foo":"bar", "_ttl":"30s" }
Just in case "30s" was wrong, I've also tried using 30000 (milliseconds).

Nothing I do causes the document to expire. What am I doing wrong?

Hi Nathan,

Can you please tell me how did you get the ttl field to work for your ES setup? My mapping JSON is posted here: http://pastebin.com/4K8ZdxFH

I have sorted through tons of documentation online / offline but just can't make it working.

Any help will be extremely helpful.

Thanks,

  • d

Hey,

can you maybe explain, for what index you expect what kind of behaviour,
just to manage expectations?

This is a sample for TTL, but maybe you want to have some additional
features?

curl -X DELETE localhost:9200/test
curl -X PUT localhost:9200/test

curl -X PUT localhost:9200/test/tweet/_mapping -d '{
"tweet" : {
"_ttl" : { "enabled" : true }
}
}'

curl -X PUT 'localhost:9200/test/tweet/1?ttl=1m' -d '{
"foo" : "bar"
}'

curl -X GET localhost:9200/test/tweet/1

sleep 120

curl -X GET localhost:9200/test/tweet/1

You will see in the last GET call, that the document has been removed. Also
note, that the pruning process, which removes stale documents, runs every
60 seconds, so it may last up to 120 seconds, until documents are really
deleted. You can configure that interval via the indices.ttl.interval
setting.

If you have further questions, feel free to ask.

--Alex

On Tue, Oct 1, 2013 at 11:15 PM, dib.g dibyajyotighosh@gmail.com wrote:

Hi Nathan,

Can you please tell me how did you get the ttl field to work for your ES
setup? My mapping JSON is posted here: es-mapping.json - Pastebin.com

I have sorted through tons of documentation online / offline but just can't
make it working.

Any help will be extremely helpful.

Thanks,

  • d

--
View this message in context:
http://elasticsearch-users.115913.n3.nabble.com/can-t-get-ttl-to-work-tp3933447p4041990.html
Sent from the Elasticsearch Users mailing list archive at Nabble.com.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.