Kibana/Elasticsearch 6.8 - delete_by_query returns 原因 "blocked by: [FORBIDDEN/8/index write (api)];"

Kibana/Elasticsearch 6.8 - delete_by_query returns reason "blocked by: [FORBIDDEN/8/index write (api)];"

我正在使用 Kibana 6.8 中的 Dev Tools 通过查询删除文档,但我收到了类型为“cluster_block_exception”的 403,原因“被阻止:[FORBIDDEN/8/index write (api)];".

我使用了以下命令:

curl -XPOST "http://localhost:9200/my_index/_delete_by_query" -H 'Content-Type: application/json' -d'
{
  "query": {
    "match_all": {}
  }
}'

这是一个示例响应:

{
  "took": 26,
  "timed_out": false,
  "total": 2,
  "deleted": 0,
  "batches": 1,
  "version_conflicts": 0,
  "noops": 0,
  "retries": {
    "bulk": 0,
    "search": 0
  },
  "throttled_millis": 0,
  "requests_per_second": -1,
  "throttled_until_millis": 0,
  "failures": [
    {
      "index": "my_index",
      "type": "doc",
      "id": "TnOKCHMBlyetxY-P6HZ_",
      "cause": {
        "type": "cluster_block_exception",
        "reason": "blocked by: [FORBIDDEN/8/index write (api)];"
      },
      "status": 403
    },
    {
      "index": "my_index",
      "type": "doc",
      "id": "T3OKCHMBlyetxY-P6XYF",
      "cause": {
        "type": "cluster_block_exception",
        "reason": "blocked by: [FORBIDDEN/8/index write (api)];"
      },
      "status": 403
    }
  ]
}

如能提供有关如何设置适当权限的任何帮助,我们将不胜感激。谢谢。

您可以尝试先通过此请求更改索引的状态:

PUT /my_index/_settings { "index": { "blocks": { "write": "false" } } }

并且在第二次,您必须确定是什么原因导致了这种索引状态(索引策略,文件系统:85% 的“低水位线”?)