Tec*_*Sid 2 elasticsearch kibana
有什么办法可以删除除一个索引以外的所有索引?
我们可以在GET请求中使用文档的元数据_index:
GET _count
{
"query": {
"match": {
"_index": "indexname"
}
}
}
Run Code Online (Sandbox Code Playgroud)
上面的查询没有任何意义,而只是表明我们可以在我提到的查询中使用_index。
我已经尝试过以下查询,但是我猜_all API不支持查询。
DELETE _all
{
"query" : {
"bool" : {
"must_not" : [
{
"match": {
"_index": "indexname"
}
}
]
}
}
}
Run Code Online (Sandbox Code Playgroud)
有没有什么方法可以删除所有索引(一个或多个除外)而不使用批量API?
尝试使用多个索引语法。您可以使用指定所有索引,*然后使用排除其中一些索引-。
假设我们需要删除除foo和以外的所有索引bar,因此HTTP请求应为
curl -X DELETE -i 'http://{server}:{port}/*,-foo,-bar'
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
967 次 |
| 最近记录: |