我是elasticsearch的新手,也是laravel的某个地方..我正在尝试用laravel配置elasticsearch。 elasticsearch正在9200端口上运行。当执行下面的代码时,它会抛出cURL错误。我从未配置1080端口。不知道为什么它试图连接1080端口?如何更改此端口?
码
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Elasticsearch\ClientBuilder;
use Elastica\Client as ElasticaClient;
class clientController extends Controller
{
protected $elasticsearch;
protected $elastica;
public function __construct()
{
$logger = ClientBuilder::defaultLogger('d:/your.log');
$this->elasticsearch = ClientBuilder::create()
->setLogger($logger)
->setRetries(0)
->build();
$elasticConfig=['host'=>"locahost",
"port"=>9200,
"index"=>'pets'];
$this->elastica = new ElasticaClient($elasticConfig);
}
public function elasticsearchTest(){
dump($this->elasticsearch);
// echo "\n\n Retrive Doc";
$param = [
'index' => 'pets',
'type' => 'dog',
'id'=>'1'
];
$res = $this->elasticsearch->get($param);
dump($res); exit;
}
}