arunfung / scout-elasticsearch
Laravel Scout ElasticSearch Driver
v0.0.9
2021-08-21 22:29 UTC
Requires
- php: ^7.4
- elasticsearch/elasticsearch: ~7.0
- laravel/scout: ~7.0
Requires (Dev)
- mockery/mockery: ^1.0
- phpunit/phpunit: ^7.0|^8.0
Suggests
- elasticsearch/elasticsearch: Required to use the ElasticSearch engine (^7.0).
- laravel/scout: Required laravel scout (^7.1).
README
scout-elastic-search
Introduction
Currently, laravel Scout only supports Algolia driver, This package is ElasticSearch driver for laravel Scout.
Installation
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,
Configuration
- 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
Usage
Documentation for Scout can be found on the Laravel website.