8 months ago

How to Tell If Elastic Search with Scout is setup correctly

Posted 8 months ago by chrisgrim

Hi, I followed this tutorial to setup Scout and Elastic Search. I had no errors throughout the entire process but when I try to do a search it returns an empty array. I even created a new model for event named work and then have

    public function search(Request $request)
        return Event::search('work')->get();


Yet it returns an empty array. Is there a way to check what models have been imported with php artisan scout:import App\Event? Or to verify that it even worked? Like I said, everything seemed to install perfectly with the tutorial so I can't understand what is going wrong. Here is my event.php model


namespace App;

use Laravel\Scout\Searchable;
use Illuminate\Database\Eloquent\Model;

class Event extends Model
    use Searchable;

my app.php


My scout.php

  'driver' => env('SCOUT_DRIVER', 'elasticsearch'),

'elasticsearch' => [
        'index' => env('ELASTICSEARCH_INDEX', 'laravel'),
        'hosts' => [
            env('ELASTICSEARCH_HOST', 'http://localhost'),

in my .env file


and when I go to that port I can see elasticsearch is up and running


Please sign in or create an account to participate in this conversation.