ErickTamayo / laravel-scout-elastic

Elastic Driver for Laravel Scout
MIT License
916 stars 242 forks source link

Class "ScoutEngines\Elasticsearch\ElasticsearchProvider" not found - Laravel 9 #178

Closed amitleuva1987 closed 2 years ago

amitleuva1987 commented 2 years ago

Stack Versions

Laravel : 9.19 Laravel Scout : 9.4 elasticsearch/elasticsearch: 8.4 tamayo/laravel-scout-elastic: 8.1

I installed everything, then I placed below service providers in "config/app.php"

Laravel\Scout\ScoutServiceProvider::class,
ScoutEngines\Elasticsearch\ElasticsearchProvider::class,

Then I try to import models in elasticsearch using below command

sail artisan scout:import 'App\Models\Product'

I receive below error

Class "ScoutEngines\Elasticsearch\ElasticsearchProvider" not found

If I remove 'ElasticsearchProvider' class from 'config/app.php', I get below error

Elastic\Elasticsearch\ClientBuilder::setHosts(): Argument #1 ($hosts) must be of type array, null given, called in /var/www/html/vendor/tamayo/laravel-scout-elastic/src/LaravelScoutElasticProvider.php on line 23

amitleuva1987 commented 2 years ago

It doesn't really required to be placed in the service provider's list