如何在Elasticsearch中异步可靠地删除快照

时间:2019-04-11 09:07:25

标签: elasticsearch

我正在使用Elasticsearch 6.3

当我使用Snapshots REST API删除快照时,我遇到两个问题。

首先,当我运行删除快照时,它将坐下来等待快照被删除,这可能需要花费相当长的时间,理想情况下,我希望它立即返回被接受的状态,这将成为我的第二个问题:等待此响应将超时并返回超时响应。

例如

curl -i -X DELETE https://cluster/_snapshot/repository-name/snapshot-name
HTTP/2 504
date: Wed, 10 Apr 2019 16:55:57 GMT
content-type: application/json
cache-control: no-cache
{
  "message": "Request Timeout",
}

这可以通过使用wait_for_completion URL参数来解决,但是删除无法识别

curl -X DELETE "cluster/_snapshot/repository-name/snapshot-name?wait_for_completion=false" | jq
{
  "error": {
    "root_cause": [
      {
        "type": "illegal_argument_exception",
        "reason": "request [/_snapshot/repository-name/snapshot-name] contains unrecognized parameter: [wait_for_completion]"
      }
    ],
    "type": "illegal_argument_exception",
    "reason": "request [/_snapshot/repository-name/snapshot-name] contains unrecognized parameter: [wait_for_completion]"
  },
  "status": 400
}

对我而言,开始删除快照的最佳方法是什么,以便我可以触发删除而无需等待删除完成?

0 个答案:

没有答案