简体   繁体   English

为什么我不能绑定 Elasticsearch 和 Laravel Scout?

[英]Why can't I bind Elasticsearch and Laravel Scout?

I decided to test Elasticsearch in conjunction with Laravel Scout.我决定与 Laravel Scout 一起测试 Elasticsearch。 I tookthis article as a basis我以这篇文章为基础

Attempt #1尝试#1

composer require elasticsearch/elasticsearch - installing ES for Laravel composer require elasticsearch/elasticsearch elasticsearch - 为 Laravel 安装 ES

composer require laravel/scout - installing latest version for Scout (9.1) composer require laravel/scout - 为 Scout (9.1) 安装最新版本

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

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:我自己理解这个捆绑包 package 已经六个月没有在 github 上更新了,因此有必要获得必要版本的 laravel/scout,所以我更改了操作顺序并这样做:

Attempt #2尝试#2

composer require elasticsearch/elasticsearch - installing ES for Laravel composer require elasticsearch/elasticsearch elasticsearch - 为 Laravel 安装 ES

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 composer require tamayo/laravel-scout-elastic - 安装此 package 希望他能获得必要版本的 laravel/scout 作为自己的依赖项,以确认这一点 - 我在控制台中看到他拉起 laravel/scout:8.6 .1

Now no mistakes, I'm moving on:现在没有错误,我继续:

I go to config/app.php and add:我 go 到config/app.php并添加:

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

Run php artisan vendor:publish运行php artisan vendor:publish

And now I get new error:现在我得到新的错误:

Class 'ScoutElastic\ScoutElasticServiceProvider' not found

What am I doing wrong?我究竟做错了什么?

Solution: don't add ScoutEngines\Elasticsearch\Elastic search Provider:: class, to config/app.php解决方法:不要在config/app.php中添加ScoutEngines\Elasticsearch\Elastic search Provider:: class, class

Everything works fine without adding this provider一切正常,无需添加此提供程序

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM