arunfung/scout-elasticsearch

Laravel Scout ElasticSearch Driver

v0.0.8 2019-10-08 02:33 UTC

This package is auto-updated.

Last update: 2020-11-17 12:06:20 UTC


README

Build Status Scrutinizer Code Quality Code Coverage Total Downloads Latest Stable Version License

scout-elastic-search

English | 中文

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.