Matt
Matt

Reputation: 4387

Elasticsearch TTL not working

I use elasticsearch for logs, I don't want to use daily index to delete them with a cron job but with the TTL. I 've actived and set TTL with the value: 30s. I have a succesfull answer when I send this operation and I can see the TTL value(in milliseconds) when I do the mapping request. All seems good but documents are not be deleted...

_mapping :

{
    "logs" : {
        "webservers" : {
            "_ttl" : {
                "default" : 30000
            },
            "properties" : {
                @timestamp" : {         
                    "type" : "date",
                    "format" : "dateOptionalTime" 
                }
            }
        }
    }
}

Upvotes: 0

Views: 2286

Answers (1)

javanna
javanna

Reputation: 60205

I guess you just need to enable _ttl for your type, which is disabled by default. Have a look here.

{
    "webservers" : {
        "_ttl" : { "enabled" : true, "default" : "30s" }
    }
}

Upvotes: 1

Related Questions