无法使用ElasticSearch-PHP更新ES设置

时间:2018-12-25 11:48:40

标签: elasticsearch elasticsearch-settings elasticsearch-php

ES中已经有一个索引。我正在使用ElasticSearch-PHP作为客户端。 根据{{​​3}},这些代码应更改ES设置:

$params = [
   'index' => 'my_index',
   'body' => [
      'settings' => [
         'number_of_replicas' => 0,
         'refresh_interval' => -1
       ]
    ]
];

$response = $client->indices()->putSettings($params);

但是在运行代码后会显示此错误:

**Fatal error** : Uncaught exception 'Elasticsearch\Common\Exceptions\Forbidden403Exception' with message '{"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}

我该如何解决? 预先谢谢你。

1 个答案:

答案 0 :(得分:0)

您的elasticsearch服务器主机可能存储不足。 在Kibana Dev工具中运行以下命令。至少应该暂时解决该问题。

PUT .kibana/_settings
{
  "index": {
    "blocks": {
      "read_only_allow_delete": "false"
    }
  }
}