开启服务
切换到ES的bin目录
双击elasticsearch.bat 启动elasticsearch服务
在thinkPHP 5 框架中使用composer安装Es扩展
composer require elasticsearch/elasticsearch
创建索引
public function index()
{
$es = ClientBuilder::create()->setHosts(['127.0.0.1:9200'])->build();
$params = [
'index' => 'movies',//类似于库名
'body' => [
'settings' => [
'number_of_shards' => 3,
'number_of_replicas' => 2
],
'mappings' => [
'_source' => [
'enabled' => true
],
'properties' => [
'title' => [
&