Ttl is enabled but it is not deleting document


(Vikas Gopal) #1

Hi Experts,

I am using ES 1.7.1, my requirement is to delete document which are 10 days old . So for this I am using ttl mapping something like

{
 "template_main":{
    "template" : "abc*",
    "settings" : {
        "index.query.default_field" : "message",
        "index":{
        "analysis":{
           "analyzer":{
              "analyzer_keyword":{
		"type": "custom",
                 "tokenizer":"keyword",
                 "filter":"lowercase"
              }
           }
        }
     }
    },
	 
    "mappings" : {
        "_default_" : {
		"_ttl": {"enabled": true,"default": "10d"},
                "_all" : {"enabled" : false},			
			"properties" : {
			  "rt": {"type": "date"},
                          "spt" :{"type": "integer","doc_values" : true}
				}
			}
		}
	}
}

Now when I am creating index based on rt(receive time) using LS, documents are not getting deleted which are older than 10 days . I cheeked my data in the log file it is old. Please suggest what I am missing .


(Vikas Gopal) #2

I do not understand where is the problem , even I set** indices.ttl.interval** property , but it's still not working .


(Mark Walkom) #3

If you are using LS then why aren't you using time based indices?

is there anything in the ES logs?


(Vikas Gopal) #4

Actually my index has already been created and it has millions of documents I do not want to reindex whole data .

Now regarding ttl , a very strange thing which I observed is , if I mention ttl:enable and default:3s in the mapping and indices.ttl.interval:3s , then it starts deleting document , but it deletes everything as data is older than 3s . It does not work when I use 1d or 10 min any other perameter, not sure why it is like this .


(Mark Walkom) #5

This is tiny, it's well worth reindexing to time based indices in this instance.


(Vikas Gopal) #6

ok, so I am opting this option, thanks again.


(system) #7