Reputation: 1979
Following delete by query plugin documentation I have managed to delete records from my elasticseatch server with this simple query:
{
"query": {
"term": {
"field1": "value1"
}
}
}
Now, I have field date_time. What I would like to achieve is to delete all records which have date_time value before today (date_time < today ). There is no information in the docs about more complex delete queries. Is this possible ?
Upvotes: 0
Views: 523
Reputation: 217274
You can simply use a range
query and some date math like this:
{
"query": {
"range": {
"date_time": {
"lt" : "now/d"
}
}
}
}
Upvotes: 1