码迷,mamicode.com
首页 > Web开发 > 详细

Es 全文 PHP 操作

时间:2019-08-09 15:51:50      阅读:127      评论:0      收藏:0      [点我收藏+]

标签:err   header   orb   存储空间   http   节点   exe   UNC   dex   

 

1、删除对应的es 节点

$head = ‘Content-Type: application/json‘;
$json = ‘‘;
$res = Curl_es("http://127.0.0.1:9200/my_index_2?pretty",‘DELETE‘,$json,$head);

function Curl_es($url, $method, $data_string, $head)
{
    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array($head));
    $result = curl_exec($ch);
    if (curl_errno($ch)) {
        print curl_error($ch);
    }
    curl_close($ch);
    return $result;
}

2、retrying failed action with response code: 403 ({"type"=>"cluster_block_exception", "reason"=>"blocked by: [FORBIDDEN/12/index read-only / allow delete (api)]

  这是由于ES新节点的数据目录data存储空间不足,导致从master主节点接收同步数据的时候失败,此时ES集群为了保护数据,会自动把索引分片index置为只读read-only

$head = ‘Content-Type: application/json‘;
$json = ‘{
    "index":{
        "blocks":{
        "read_only_allow_delete":"false"
        }
    }}‘;
$res = Curl_es("http://10.10.1.136:9200/_settings?pretty", ‘PUT‘, $json, $head);

3、es设置index.max_result_window(就是from+size,默认大小10000),可通过如下方式修改:

$head = ‘Content-Type: application/json‘;
$json = ‘{
    "index":{
        "max_result_window": 10000000
    }}‘;
$res = Curl_es("http://10.10.1.136:9200/_settings?pretty", ‘PUT‘, $json, $head);
echo $res;

Es 全文 PHP 操作

标签:err   header   orb   存储空间   http   节点   exe   UNC   dex   

原文地址:https://www.cnblogs.com/lclclouds/p/11327173.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!