1、laravel安装ElasticSearch
1、安装ElasticSearch(一定要安装7.*版本,推荐7.1,否则 tamayo/laravel-scout安装一直报错!)
composer require elasticsearch/elasticsearch=“^7.,1” --ignore-platform-reqs
2、安装laravel es驱动(最终使用的这个扩展,索引字段类型在创建mysql表配置好即可)
composer require tamayo/laravel-scout-elastic --ignore-platform-reqs
3、安装scout
composer require tamayo/laravel-scout-elastic --ignore-platform-reqs
scout配置 https://learnku.com/docs/laravel/8.x/scout/9422#e05dce
4、安装es索引引擎e matchish/laravel-scout-elasticsearch (先不用装此扩展,因为导入es太慢)
composer require matchish/laravel-scout-elasticsearch=“^4.0” --ignore-platform-reqs
配置: https://github.com/matchish/laravel-scout-elasticsearch
生成 Scout 配置文件 (config/scout.php)
php artisan vendor:publish --provider=“Laravel\Scout\ScoutServiceProvider”
5.指定 Scout 驱动
第一种:在.env 文件中指定(建议&#x