Delete documents of an index older than 7 days

I want to delete documents from my index ''index_name" which are older than 7 days.
The field I want to use is not @timestamp and is another field "date" in that index.

I am not sure of the DELETE QUERY.

Please help

you can use the delete query along with time range

I am using the query in screenshot. The only problem is date less than : now-5 is deleting documents as now-4. Suppose if I run it today 11th Sept it is deleting docs of 6th September too.

make it now-6d and try to run
or moreover you can use it also

"range": {
    "date": {
        "gte": "2015-11-01",
        "lte": "2015-11-30"
    }
}

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