sl0wik / laravel-scout-elasticsearch-driver
Elasticsearch Driver for Laravel Scout with multi-index support.
Requires
- php: >=5.6.4
- elasticsearch/elasticsearch: ^5.0
- laravel/scout: ^3.0|^4.0
Requires (Dev)
- fzaninotto/faker: ~1.4
- mockery/mockery: 0.9.*
- phpunit/phpunit: ~5.0
Suggests
- elasticsearch/elasticsearch: Required to use the Elasticsearch engine (^5.0).
README
This is the Elasticsearch driver for Laravel Scout with multiple indexes support.
Package is based on tamayo/laravel-scout-elastic, and created to replace depeceated types, with Index per document type solution.
Contents
Installation
composer require sl0wik/laravel-scout-elasticsearch-driver
Add the Scout service provider and the package service provider in your app.php config:
// config/app.php 'providers' => [ ... Laravel\Scout\ScoutServiceProvider::class, ... ScoutEngines\Elasticsearch\ElasticsearchProvider::class, ],
Setting up Elasticsearch configuration
After you've published the Laravel Scout package configuration update config/scout.php:
'driver' => env('SCOUT_DRIVER', 'elasticsearch'), ... 'elasticsearch' => [ 'hosts' => [ env('ELASTICSEARCH_HOST', 'http://localhost'), ], ], ...
Migration
If you are migrating from ErickTamayo/laravel-scout-elastic, keep in mind that instead of config('scout.elasticsearch.index')
this package is using searchableAs()
method to get index name. By default it will return model config('scout.prefix').$this->getTable();
. Your new data will be stored under different indexes so you will need to reindex everything.
Usage
Now you can use Laravel Scout as described in the official documentation
Credits
License
The MIT License (MIT).