elastic / elasticsearch

Free and Open, Distributed, RESTful Search Engine
https://www.elastic.co/products/elasticsearch
Other
68.57k stars 24.36k forks source link

Index ttl not working #8949

Closed geezerrrr closed 9 years ago

geezerrrr commented 9 years ago

I tried the following and expecting the documents to disappear in 1 minute:


curl -XPUT 'http://localhost:9200/test_ttl'
curl -XPUT 'http://localhost:9200/test_ttl/test/_mapping' -d 
'{
  "test": {
    "_ttl": {
      "enable": true,
      "default": "1m"
    }
  }
}'
curl -XPOST 'http://localhost:9200/test_ttl/test' -d 
'{
  "user": "test",
  "_ttl": "1m"
}'

After 5 minute, the data can still be obtained.

FabianKoestring commented 9 years ago

note on documents expirationedit

Expired documents will be automatically deleted regularly. You can dynamically set the indices.ttl.interval to fit your needs. The default value is 60s.

The deletion orders are processed by bulk. You can set indices.ttl.bulk_size to fit your needs. The default value is 10000.

Note that the expiration procedure handle versioning properly so if a document is updated between the collection of documents to expire and the delete order, the document won’t be deleted. http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-ttl-field.html

Maybe control your indices.ttl.interval value!