Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: php bin/magento setup:upgrade fails while trying to install elasticsuite 2.11.6.1 for magento 2.4.7 with elasticsearch 8 #3273

Closed
Playhf opened this issue May 9, 2024 · 8 comments
Assignees

Comments

@Playhf
Copy link

Playhf commented May 9, 2024

php bin/magento setup:upgrade failse with No alive nodes found in your cluster error while installing data from Smile_ElasticsuiteCatalog module.

Hello, I'm trying to install smile/elasticsuite:2.11.6.1 for magento magento/product-community-edition:2.4.7 and with magento/module-elasticsearch-8 installed. elasticsearch/elasticsearch module version is 8.5.3 (coming from magento/module-elasticsearch-8)

Steps to reproduce

  1. magento/product-community-edition:2.4.7
  2. composer require smile/elasticsuite ~2.11.0
  3. php bin/magento setup:upgrade

Expected result

Setup upgrade installs all things for elasticsuite module

Actual result

image

As you can see from the first screen issue is coming from \Smile\ElasticsuiteCatalog\Setup\InstallData::install (line 97)
After that module tries to create ElasticSuiteClient in \Smile\ElasticsuiteCore\Client\Client::getEsClient
as you can see here it always returns \OpenSearch\Client for some reason.
image

In \Smile\ElasticsuiteCore\Client\ClientBuilder::build it tries to build a client and on line 109 clientBuilder creates client object which must be an instance of \OpenSearch\Client
image
Screenshot 2024-05-09 at 15 39 49
After that attempting to make a test connection it fails because I don't have Open search installed.

I can see a comment in \Smile\ElasticsuiteCore\Client\ClientBuilder::build it claims it must work with elasticsearch 8 but it doesn't
We decided to use the OpenSearch client because he is versatile and can work with : * - Elasticsearch 7.x * - Elasticsearch 8.x * - Opensearch 1.x * - Opensearch 2.x

Please assist. Thanks

@vahonc
Copy link
Collaborator

vahonc commented May 9, 2024

Hello @Playhf,

Yes, we know about it. For now, you can find a workaround here #2880.

BR,
Vadym

@vahonc vahonc assigned vahonc and Playhf and unassigned vahonc May 9, 2024
@Playhf
Copy link
Author

Playhf commented May 9, 2024

Hello @Playhf,

Yes, we know about it. For now, you can find a workaround here #2880.

BR, Vadym

@vahonc so what is the workaround? remove magento/module-elasticsearch-8 module and use elasticsearch/elasticsearch ~7.17.0 composer package?

Thanks

@vahonc
Copy link
Collaborator

vahonc commented May 9, 2024

@Playhf

Yes, stay tuned, but keep using client v7 for now, while we work under refactoring.

BR,
Vadym

@Playhf
Copy link
Author

Playhf commented May 9, 2024

@vahonc should i also downgrade smile/elasticsuite package version to any older? i removed magento/module-elasticsearch-8 package now have elasticsearch/elasticsearch:v7.12 but it still tries to execute OpenSearch since it is hardcoded in \Smile\ElasticsuiteCore\Client\ClientBuilder constructor.

Thanks

@vahonc
Copy link
Collaborator

vahonc commented May 9, 2024

@Playhf,

You don't need to downgrade smile/elasticsuite package version to any older, you just don't need to use the Elasticsearch8 Magento module.

Most probably, running composer remove magento/module-elasticsearch-8 will make you rollback to elasticsearch/elasticsearch on version 7.x.

If not, try doing:

$ composer remove magento/module-elasticsearch-8
$ composer require elasticsearch/elasticsearch ~7.17.0

Maybe you have an version issue: https://github.com/magento/magento2/blob/2.4.7/composer.json#L44

BR,
Vadym

@vahonc
Copy link
Collaborator

vahonc commented May 14, 2024

@Playhf

As for this:

i removed magento/module-elasticsearch-8 package now have elasticsearch/elasticsearch:v7.12 but it still tries to execute OpenSearch since it is hardcoded in \Smile\ElasticsuiteCore\Client\ClientBuilder constructor.

Are you sure that you select ElasticSuite as the default search engine?

Screenshot from 2024-05-14 12-09-48

Also, please check/provide the configuration of your Elasticsearch Client.

Screenshot from 2024-05-14 12-11-04

BR,
Vadym

@romainruaud
Copy link
Collaborator

@Playhf that's normal to have an OpenSearch client.

OpenSearch is just a fork of Elasticsearch (by Amazon). The OpenSearch PHP client is also a fork of the Elasticsearch PHP client v7.

Since the v8 of the Elasticsearch PHP client, there has been many changes in the code, making this client only reliable for connecting to ES 8 backend servers.

Since we have to support all the possible backend servers (Opensearch 1.x and 2.x, Elasticsearch 7.x and 8.x), we had to find the best possible option, which is to use the OpenSearch PHP client, because this client is able to connect to all the pre-listed flavors of Elasticsearch and Opensearch servers.

Please refer to Vadym's last post to ensure your search engine configuration is correct (Elasticsuite is selected as engine, and proper servers are configured).

Please also check the "Magento is already installed" chapter of our doc : https://github.com/Smile-SA/elasticsuite/wiki/ModuleInstall#magento-is-already-installed-

You might have to run these commands (with proper config) :

bin/magento config:set -le smile_elasticsuite_core_base_settings/es_client/servers node-1:9200,node-2:9200
bin/magento config:set -le smile_elasticsuite_core_base_settings/es_client/enable_https_mode 0
bin/magento config:set -le smile_elasticsuite_core_base_settings/es_client/enable_http_auth 0
bin/magento config:set -le smile_elasticsuite_core_base_settings/es_client/http_auth_user ""
bin/magento config:set -le smile_elasticsuite_core_base_settings/es_client/http_auth_pwd ""
bin/magento config:set -le catalog/search/engine elasticsuite
bin/magento app:config:import

Copy link

This issue was waiting update from the author for too long. Without any update, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now. Please don't hesitate to comment on the bug if you have any more information for us; we will reopen it right away! Thanks for your contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants