0

I decided to test Elasticsearch in conjunction with Laravel Scout. I took this article as a basis

Attempt #1

composer require elasticsearch/elasticsearch - installing ES for Laravel

composer require laravel/scout - installing latest version for Scout (9.1)

composer require tamayo/laravel-scout-elastic - installing package for ES+Scout

I get this error:

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - tamayo/laravel-scout-elastic[8.0.0, ..., 8.0.2] require laravel/scout ^8.0 -> found laravel/scout[v8.0.0, ..., 8.x-dev] but it conflicts with your root composer.json require (^9.1).
    - Root composer.json requires tamayo/laravel-scout-elastic ^8.0 -> satisfiable by tamayo/laravel-scout-elastic[8.0.0, 8.0.1, 8.0.2].

I understand for myself that this bundle package has not been updated on github for six months and it is necessary to get to it the necessary version of laravel/scout, so I change the order of actions and do so:

Attempt #2

composer require elasticsearch/elasticsearch - installing ES for Laravel

composer require tamayo/laravel-scout-elastic - installing this package hoping that he will get the necessary version of laravel/scout for himself as a dependency, in confirmation of this - I see in the console that he pulled up laravel/scout:8.6.1

Now no mistakes, I'm moving on:

I go to config/app.php and add:

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

Run php artisan vendor:publish

And now I get new error:

Class 'ScoutElastic\ScoutElasticServiceProvider' not found

What am I doing wrong?

1 Answers1

0

Solution: don't add ScoutEngines\Elasticsearch\Elastic search Provider:: class, to config/app.php

Everything works fine without adding this provider

  • Its not working. it throws 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 – Amit Sep 07 '22 at 05:52