1

i have Mangento 2.2 site on which i want to add elastic search. According to the documentation we can add the same using composer, but my problem is i cannot use composer. Is there any other way to achieve the same?

4
  • I'm also facing same issue Commented Sep 8, 2020 at 12:27
  • Magneto 2 comes with elasticsearch out of the box. as long as your server is setup for elasticsearch then you should just be able to set it up Commented Sep 8, 2020 at 12:47
  • No, @DavaGordon It started after 2.2, its not included in 2.2. I checked with server support also. Its not coming by default in magento 2.2 Commented Sep 8, 2020 at 13:43
  • 1
    To manually download you can go to github.com/Smile-SA/elasticsuite/tree/2.2.x and download it if you want to install in the app folder you will need to do a bit of work in regards to folder structures of each module Commented Sep 8, 2020 at 16:55

1 Answer 1

0

The simplest solution is to execute composer locally on your machine and upload the generated files to your server somewhere in <magento-root>\lib or create a new folder on <magento-root> folder.

Steps to implement at local machine. This is for core elastic search lib.

  1. create a composer.json on your local machine with following require

{ "require": { "elasticsearch/elasticsearch": "^7.0" } }

  1. run composer install -vvv

  2. now vendor folder will be there it will load all the dependencies with autoload.php file which as code to include all the dependencies.

There will be duplication of dependencies like Psr\Logger and it can be removed if its already there in Magento's(on your web server where you intent to deploy) vendor folder.

From your local machine only if needed - optional.

  1. composer remove ezimuel/ringphp

  2. composer remove psr/log

Internally, composer is

A) downloading all the dependencies and

B) generating an "autoload.php" file which has code to include all the dependencies.

Once everything is generated, the files and directory structure are static and can easily be moved around.

At this stage you will have core elastic search lib package ready in your local machine ready to deploy on your server.

  1. In Magento (2.2) project deploy that zip folder to server in <magento-root>\lib or custom folder of your choice on <magento-root> folder.

Magento Part

Now install these two Magento's modules in app/code/Magento/Elasticsearch and Magento/Elasticsearch7

  1. https://github.com/magento/magento2/tree/2.4/app/code/Magento/Elasticsearch

  2. https://github.com/magento/magento2/tree/2.4/app/code/Magento/Elasticsearch7

you may have to change some require_once or namespace settings in Magento/Elasticsearch and Magento/Elasticsearch7 modules as per your core elasticsearch lib location.

Preconditions

  1. Web server should have Elastic search 7 version installed.
  2. Some Elastic Search Requirements

Check elasticsearch installed or not

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.