I use elasticsearch v 5.5.2 with laravel 5.3 - scout v -2.0.
I a trying to executing below code but I am getting this error. NoNodesAvailableException.
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()
{
$this->elasticsearch = ClientBuilder::create()
//->setConnectionPool('\Elasticsearch\ConnectionPool\SniffingConnectionPool', [])
->build();
$elasticConfig=['host'=>"locahost",
"port"=>9200,
"index"=>'pets'];
$this->elastica = new ElasticaClient($elasticConfig);
}
public function elasticsearchTest(){
$param = [
'index' => 'pets',
'type' => 'dog',
'id'=>'1'
];
$res = $this->elasticsearch->get($param);
dump($res);
}
}
Error
NoNodesAvailableException in StaticNoPingConnectionPool.php line 51: No alive nodes found in your cluster
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire