ElasticSearch Driver For Laravel Scout
rystlee/laravel-scout-elasticsearch is a Laravel package for elasticsearch driver for laravel scout.
It currently has 1 GitHub stars and 16 downloads on Packagist (latest version 1.0.0).
Install it with composer require rystlee/laravel-scout-elasticsearch.
Discover more Laravel packages by rystlee
or browse all Laravel packages to compare alternatives.
Last updated
This package is the Elasticsearch driver for Laravel Scout.
composer require rystlee/laravel-scout-elasticsearch
You must have a Elasticsearch server up and running with the index you want to use created
If you need help with this please refer to the Elasticsearch documentation
After you've published the Laravel Scout package configuration:
// config/scout.php
// Set your driver to elasticsearch
'driver' => env('SCOUT_DRIVER', 'elasticsearch'),
...
'elasticsearch' => [
'index' => env('ELASTICSEARCH_INDEX', 'laravel'),
'hosts' => [
env('ELASTICSEARCH_HOST', 'http://localhost'),
],
],
...
RystLee\LaravelScoutElastic\Traits\EsSearchable in the model that needs highlight search results.
Then the collection results will contains highlight attribute which has highlight hits relevant to the
scout setting toSearchableArray. @if(isset($post->highlight['body']))
@foreach($post->highlight['body'] as $item)
......{!! $item !!}......
@endforeach
@else
{{ mb_substr($post->content, 0, 150) }}......
@endif
Now you can use Laravel Scout as described in the [official documentation](https://laravel.com/docs/5.3/scout
The MIT License (MIT).