cancel
Showing results for 
Search instead for 
Did you mean: 

Losing at the get search working game

Losing at the get search working game

I'm currently playing the game that it seems hundreds of other people have been playing which is trying to get Magento configured to correctly interface with ElasticSearch.

 

I've installed ElasticSearch 8.11

 

To elasticsearch.yml I've added this to resolve a couple of errors.

 

xpack.security.enabled: false

indices:
  id_field_data:
    enabled: true

 

I have Magento 2.4.7-p3 installed using

 

php bin/magento setup:install `
--base-url=http://magento.local.com `
--db-host=localhost `
--db-name=magento1 `
--db-user=root `
--db-password=root `
--admin-firstname=admin `
--admin-lastname=admin `
--admin-email=admin@admin.com `
--admin-user=admin `
--admin-password=admin123 `
--language=en_US `
--currency=USD `
--timezone=America/Chicago `
--use-rewrites=1 `
--search-engine=elasticsearch8

That succeeds after hacking `C:\Programs\xampp\htdocs\magento1\vendor\magento\framework\Image\Adapter\Gd2.php` to accept local files. (A bug that's been known about for over 4 years now!!)

 

The site doesn't load and I have an error in the debug log

 

[2025-02-07T15:02:27.972816+00:00] main.CRITICAL: Elasticsearch\Common\Exceptions\BadRequest400Exception: {"error":"no handler found for uri [/magento2_product_1_v1/document/_mapping?include_type_name=true] and method [PUT]"} in C:\Programs\xampp\htdocs\magento1\vendor\elasticsearch\elasticsearch\src\Elasticsearch\Connections\Connection.php:693

In the DB there is no elasticsearch configuration in core_config_data at all (no path column contains 'elastic').

 

Running

 

composer require magento/module-elasticsearch-8 --update-with-all-dependencies

Results in the error

./composer.json has been updated
Running composer update magento/module-elasticsearch-8 --with-all-dependencies
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires magento/module-elasticsearch-8 * -> satisfiable by magento/module-elasticsearch-8[100.4.0, 100.4.1].
    - elasticsearch/elasticsearch[v8.5.0, ..., v8.5.3] require psr/http-message ^1.0 -> found psr/http-message[1.0, 1.0.1, 1.1] but these were not loaded, likely because it conflicts with another require.
    - magento/module-elasticsearch-8[100.4.0, ..., 100.4.1] require elasticsearch/elasticsearch ~8.5.0 -> satisfiable by elasticsearch/elasticsearch[v8.5.0, v8.5.1, v8.5.2, v8.5.3].

You can also try re-running composer require with an explicit version constraint, e.g. "composer require magento/module-elasticsearch-8:*" to figure out if any version is installable, or "composer require magento/module-elasticsearch-8:^2.1" if you know which you need.

Installation failed, reverting ./composer.json and ./composer.lock to their original content.

Does anyone have any advice?

 

 

2 REPLIES 2

Re: Losing at the get search working game

Hi!

This error is caused by psr/http-message not being loaded properly or due to a conflict between modules.
You can run:

composer why psr/http-message

to show the conflicting modules. Then, you can try to remove it and run the command again.

 

Another solution is to use OpenSearch, which is recommended by Adobe.

Mageplaza | Top-Rated Magento Extension and Solution Provider


Should you have any questions or concerns, feel free to contact us via consultant@mageplaza.com

Re: Losing at the get search working game

Magento and ElasticSearch integration can be a real headache, especially with version mismatches. The error suggests that the required PSR package isn’t resolving properly, likely due to conflicting dependencies. You might try explicitly requiring psr/http-message before running composer update, or using composer why-not psr/http-message to check conflicts. Also, ensuring the correct ElasticSearch module version for Magento 2.4.7-p3 is installed could help.

If you need a break from debugging, you can check out Google Doodle Baseball here: https://gamesdoodle.com/google-doodle-baseball/