config\elasticsearch.yml
network.host: 0.0.0.0
http.port: 9200
node.name: node-1
cluster.initial_master_nodes: ["node-1"]
php elasticsearch
<?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 方法文章来源:https://www.toymoban.com/news/detail-799041.html
$client->info();文章来源地址https://www.toymoban.com/news/detail-799041.html
到了这里,关于Elasticsearch本地单机配置以及php组件使用记录的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!