composer require baijunyao/laravel-scout-elasticsearch
添加 Provider ;
config/app.php
'providers' => [
// ...
/**
* Elasticsearch全文搜索
*/
Laravel\Scout\ScoutServiceProvider::class,
Baijunyao\LaravelScoutElasticsearch\ElasticsearchServiceProvider::class,
],
发布配置项;
php artisan vendor:publish --provider="Laravel\Scout\ScoutServiceProvider"
增加配置项;
.env ;
SCOUT_DRIVER=elasticsearch
ELASTICSEARCH_HOST=127.0.0.1
ELASTICSEARCH_PORT=9200
ELASTICSEARCH_SCHEME=http
如果有账号密码可以增加如下配置:
ELASTICSEARCH_USER=elastic
ELASTICSEARCH_PASS=changeme
使用 →