【问题标题】:No handler found for uri [/<url>/<url>] and method [PUT]未找到 uri [/<url>/<url>] 和方法 [PUT] 的处理程序
【发布时间】:2023-03-28 09:36:01
【问题描述】:

我在通过 Elasticsearch 发送请求时收到 No handler found for uri [/&lt;url&gt;/&lt;url&gt;] and method [PUT] 错误。

我使用的是 POST,而不是 PUT,所以我不需要使用 _id。必须使用 POST。在添加“存档”索引之前,以下请求一直有效。

$params = [
            'index' => 'servers',
            'type' => 'servers',
            'body' => [
                'servername' => $servername,
                'ip' => $ip,
                'location' => $location,
                'ping' => $ping,
                'archive' => 0
            ]
        ];
        $response = $client->index($params);

【问题讨论】:

    标签: php arrays json elasticsearch


    【解决方案1】:

    重建索引并将archive 更改为字符串而不是int,解决了该问题。

    $params = [
                'index' => 'servers',
                'type' => 'servers',
                'body' => [
                    'servername' => $servername,
                    'ip' => $ip,
                    'location' => $location,
                    'ping' => $ping,
                    'archive' => "0"
                ]
            ];
            $response = $client->index($params);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-08-11
      • 1970-01-01
      • 2016-12-13
      • 1970-01-01
      • 2022-11-02
      • 1970-01-01
      相关资源
      最近更新 更多