不保留副本
- IP和端口是ES节点的IP和端口
curl -H 'content-Type:application/json' -X PUT IP:端口/_settings -d '{"index.number_of_replicas":"0"}'
如果curl报错如下所示
-
{“error”:{“root_cause”:[{“type”:“cluster_block_exception”,“reason”:“blocked by: [FORBIDDEN/12/index read-only / allow delete (api)];”}],“type”:“cluster_block_exception”,“reason”:“blocked by: [FORBIDDEN/12/index read-only / allow delete (api)];”},“status”:403}
-
则可能是由于设置了只读权限,打开即可
去除只读权限
curl -XPUT IP:端口/_settings -H 'content-Type:application/json' -d '{"index": {"blocks": {"read_only_allow_delete": "false"}}}'