1.去elasticsearch官网下载,如果太慢可以在我上一个随笔看下载地址
2.下载完解压缩,在cmd中找到到elasticsearch的bin目录下执行.\elasticsearch.bat -d 让elasticsearch 作为一个守护进程在后台运行(如果不是windows的就是.\elasticsearch -d),
3.在laravel中安装指定的elasticsearch版本(与上面下载的版本一致),composer require "elasticsearch/elasticsearch:~7.0" (把版本号前的~去掉就可以下载指定的版本号,不然就是下载范围内最新版本)
4.在terminal中执行php artisan tinker
5.app(‘es‘)->info() 出现如下即成功
{
"name" : "pJU2v8-",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "Q3bZoaq0Qt6F2FXvSXd4Jw",
"version" : {
"number" : "6.4.2",
"build_flavor" : "default",
"build_type" : "tar",
"build_hash" : "04711c2",
"build_date" : "2018-09-26T13:34:09.098244Z",
"build_snapshot" : false,
"lucene_version" : "7.4.0",
"minimum_wire_compatibility_version" : "5.6.0",
"minimum_index_compatibility_version" : "5.0.0"
},
"tagline" : "You Know, for Search"
}