Currently, laravel Scout only supports Algolia driver, This package is ElasticSearch driver for laravel Scout.
Install the package via composer:
composer require arunfung/scout-elasticsearch
If you are using Laravel version < 5.5 or the package discovery is disabled, Must add the Scout service provider and the package service provider in your app.php
/*
* Package Service Providers...
*/
Laravel\Scout\ScoutServiceProvider::class,
ArunFung\ScoutElasticSearch\ElasticSearchServiceProvider::class,
- Publish settings
php artisan vendor:publish --provider="Laravel\Scout\ScoutServiceProvider"
php artisan vendor:publish --provider="ArunFung\ScoutElasticSearch\ElasticSearchServiceProvider"
- Set scout driver in
.env
// Set scout driver to elasticsearch
SCOUT_DRIVER=elasticsearch
- Create a new ElasticSearch index
If you need to set the mapping, you can set it in config/elasticsearch.php
// add index name into .env
ELASTIC_SEARCH_INDEX=index name
// Create a generic index mapping
php artisan es:create-index
Documentation for Scout can be found on the Laravel website.