我正在与laravel一起使用elasticsearch。当我尝试测试搜索时,它不会加载任何内容,而是向我显示
500个错误的请求
我也尝试过使用控制台,并且在那里一切正常,以及使用香草php。
以下代码是我用于弹性模型的代码:
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
use Elasticsearch\ClientBuilder;
class Elastic extends Model
{
private $client;
public function __construct(array $attributes = array()){
parent::__construct($attributes);
$this->client = ClientBuilder::create()
->setHosts(['elsys.something.com'])
->build();
}
public function client(){
return $this->client;
}
public function insert($data = array()){
$this->client()->index($data);
}
public function get($data){
return $this->client()->search($data);
}
public function updateClient($data){
return $this->client()->update($data);
}
public function deleteClient($data){
$this->client()->delete($data);
}
}