PHP code example of mobilexco / laravel-scout-elastic

1. Go to this page and download the library: Download mobilexco/laravel-scout-elastic library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mobilexco / laravel-scout-elastic example snippets


// config/app.php
'providers' => [
    ...
    Laravel\Scout\ScoutServiceProvider::class,
    ...
    ScoutEngines\Elasticsearch\ElasticsearchProvider::class,
],

ELASTICSEARCH_PROVIDER=aws

ELASTICSEARCH_PROVIDER=elastic

AWS_REGION=us-west-2

// config/scout.php
// Set your driver to elasticsearch
    'driver' => env('SCOUT_DRIVER', 'elasticsearch'),

...
    'elasticsearch' => [
        'index' => [
            // if using more than one index, you likely want to change this to each of
            // your indexes. quite possibly using searchableAs on your models.
            env('ELASTICSEARCH_INDEX', 'scout')
        ],
        'hosts' => [
            env('ELASTICSEARCH_HOST', 'http://localhost'),
        ],
        'perModelIndex' => true,
    ],
...

// config/laravel-scout-elastic
// set this if you don't want to ,
...
    'region' => env('AWS_REGION', 'us-west-2'),
...

// App/Console/Kernel.php
protected $commands = [
    ...
    \App\Console\Commands\CreateIndex::class
    ...
],
xml
<env name="SCOUT_DRIVER" value='"null"' />
bash
php artisan vendor:publish  --provider="ScoutEngines\Elasticsearch\ElasticsearchProvider"
bash
php artisan scout:create-index