Gir*_*noy 3 curl elasticsearch
我正在编写一个用于备份的 shell 脚本。问题是参数应该是 cURL 请求,并且通过 URL 传递的参数应该忽略特定索引。我阅读了 ES cat API 文档,但无法弄清楚,其他答案给出了 grep 作为解决方案。
健康状况指数 绿色开放 abcd 绿色开放 efgh 绿色开放 ijkl 绿色开放 mnop 绿色开放 qrst
执行的命令是:curl -X GET " http://hostname:port/_cat/indices/ *,-efgh"curl -s http://hostname:port/_cat/indices | grep -v “efgh”
我想忽略 efgh 而应打印其余索引。如有帮助,将不胜感激
错误:{“error”:{“root_cause”:[{“type”:“index_not_found_exception”,“reason”:“没有这样的索引”,“resource.type”:“index_or_alias”,“resource.id”:“efgh ","index_uuid":" na ","index":"efgh"}],"type":"index_not_found_exception","reason":"没有这样的索引","resource.type":"index_or_alias","资源.id":"efgh","index_uuid":" na ","index":"efgh"},"状态":404}
您可以使用以下语法:
GET _cat/indices/*,-efgh
Run Code Online (Sandbox Code Playgroud)
这意味着“包括一切,但是efgh”
在curl中,它会给出这样的结果:
curl -s -XGET 'hostname:post/_cat/indices/*,-efgh*'
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2374 次 |
| 最近记录: |