Delete documents from index based on timestamp


(Saritha) #1

I have a huge index and I want to delete/archive documents from a huge index based on timestamp.


(Ravi Shanker Reddy) #2

https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html

DeleteByQuery can be used. but its a very slow process.


(Saritha) #3

Thank you Ravi.

Is there any internal time stamp that these documents contain while getting created so that i can put a query to delete the documents older than 3 days


(Saritha) #4

Also, I am using Elastic Search 1.7.3 version. Is delete_by_query available for this version?


(Ravi Shanker Reddy) #5

https://www.elastic.co/guide/en/elasticsearch/reference/1.7/docs-delete-by-query.html

Its available in that version. But depreciated. Please have a look.


(Saritha) #6

Can you please answer the below question as well.

Is there any internal time stamp that these documents contain while getting created so that i can put a query to delete the documents older than 3 days


(David Pilato) #7

If you want to keep only 3 days of data, might be better to reindex to a new index the 3 days and drop the old one.

Probably more efficient...


(system) #8

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.