请尝试在我的Laravel 5.8项目上进行弹性搜索。所以首先我在我的macOs中安装elacticseach:
brew install elasticsearchelasticseach服务器工作正常http:// localhost:9200 /:…
你需要先安装elasticsearch:
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add - sudo apt-get install apt-transport-https echo "deb https://artifacts.elastic.co/packages/5.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-5.x.list sudo apt-get update && sudo apt-get install elasticsearch
重启服务:
sudo service elasticsearch restart
如果不起作用请编辑以下文件
/etc/elasticsearch/elasticsearch.yml
更改 network.host: localhost 然后重新启动该服务
network.host: localhost
的 UPDATE 强>
如果您确定您的elasticsearch工作正常(通过在终端中键入elasticsearch)
考虑以下步骤:
添加侦察驱动程序: composer require babenkoivan/scout-elasticsearch-driver
composer require babenkoivan/scout-elasticsearch-driver
在config / app.php的providers部分中添加两个类:
Laravel\Scout\ScoutServiceProvider::class, ScoutElastic\ScoutElasticServiceProvider::class,
编辑你的环境 SCOUT_DRIVER=elastic
SCOUT_DRIVER=elastic
运行以下命令:
php artisan vendor:publish --provider="Laravel\Scout\ScoutServiceProvider" php artisan vendor:publish --provider="ScoutElastic\ScoutElasticServiceProvider"