dscmall / laravel-scout-elastic
Elastic Driver for Laravel Scout
v7.11.6
2021-06-10 08:56 UTC
Requires
- php: ^7.1
- elasticsearch/elasticsearch: ^7.11
- laravel/scout: ^7.2
Suggests
- elasticsearch/elasticsearch: Required to use the Elasticsearch engine (^7.11.0).
README
This package provides a Elasticsearch driver for Laravel Scout.
Installation
You can install the package via composer:
composer require dscmall/laravel-scout-elastic
Laravel will automatically register the driver service provider.
Setting up Elasticsearch configuration
After you've published the Laravel Scout package configuration, you need to set your driver to elasticsearch
and add its configuration:
// config/scout.php ... // Set your driver to elasticsearch 'driver' => env('SCOUT_DRIVER', 'elasticsearch'), ... /* |-------------------------------------------------------------------------- | Elasticsearch Configuration |-------------------------------------------------------------------------- | | Here you may configure your Elasticsearch settings. | */ 'elasticsearch' => [ 'hosts' => [ env('ELASTICSEARCH_HOST', 'localhost'), // [ // 'host' => env('ELASTICSEARCH_HOST', 'localhost'), // 'port' => env('ELASTICSEARCH_PORT', '9200'), // 'scheme' => env('ELASTICSEARCH_SCHEME', 'https'), // 'path' => env('ELASTICSEARCH_PATH', '/elastic'), // 'user' => env('ELASTICSEARCH_USER', 'username'), // 'pass' => env('ELASTICSEARCH_PASS', 'password'), // ] ], ] ...
For host configuration you can refer to the official Elasticsearch documentation
Usage
Now you can use Laravel Scout as described in the Laravel Scout official documentation
License
The MIT License (MIT).