[英]How to purge data in elasticsearch index using query in curl
I am trying to delete some part of data in the elasticsearch index using curl
. 我正在尝试使用curl
删除elasticsearch索引中的部分数据。 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 提前致谢
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"
}
}
}
}'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.