Reputation: 2119
I am trying to delete some part of data in the elasticsearch index using curl
. I am trying to delete it based on the timestamp query(like to purge the data from certain time). I have tried the below query but its deleting the complete data in the index.
curl -XDELETE 'http://beepal1.tms.toyota.com:9200/logstash-sys_timestamp' -d '
{
"query":
{
"range":
{
"@timestamp":
{
"gte": "2016-05-27T07:00:00.000Z",
"lte": "2016-05-28T06:59:59.999Z"
}
}
}
}'
I don't know where I am going wrong.
Thanks in advance
Upvotes: 1
Views: 1126
Reputation: 217274
You need to install the delete by query plugin first and then you can run this:
curl -XDELETE 'http://beepal1.tms.toyota.com:9200/logstash-sys_timestamp/_query' -d '
{
"query":
{
"range":
{
"@timestamp":
{
"gte": "2016-05-27T07:00:00.000Z",
"lte": "2016-05-28T06:59:59.999Z"
}
}
}
}'
Upvotes: 2