network.host: 0.0.0.0
http.port: 9200
node.name: node-1
cluster.initial_master_nodes: ["node-1"]
<?php
require 'vendor/autoload.php';
//如果未设置密码
$client = \Elasticsearch\ClientBuilder::create()->setHosts(['xxx.xxx.xxx.xxx'])->build();
//如果es设置了密码
$client = \Elasticsearch\ClientBuilder::create()->setHosts(['http://username:password@xxx.xxx.xxx.xxx:9200'])->build()
?键值对模式
[
[
"host" => '',
"port" => '',
"user" => '',
"pass" => ''
]
]
info 方法
$client->info();