This page has moved and will be redirected soon. See Migrated topics for the complete list.
You must install Elasticsearch or OpenSearch before installing Adobe Commerce or Magento Open Source 2.4.0. See Search engine prerequisites for details.

Search engine prerequisites

As of Adobe Commerce and Magento Open Source 2.4, all installations must be configured to use Elasticsearch or OpenSearch as the catalog search solution.

OpenSearch support has been added in 2.4.4. OpenSearch is a compatible fork of ElasticSearch. All instructions to configure Magento to use ElasticSearch 7 apply to OpenSearch. Migrate from Elasticsearch to OpenSearch provides guidance on switching to OpenSearch.

Supported versions

You must install and configure either Elasticsearch or OpenSearch before installing Adobe Commerce or Magento Open Source 2.4.4.

Refer to the System Requirements for specific version information.

Recommended configuration

We recommend the following:

Installation location

All of the following tasks we discuss assume you have configured your system this way.

Search Engine diagram

The preceding diagram shows:

  • The Commerce application and the search engine are installed on different hosts.

    Running on separate hosts requires proxying to work. (Clustering the search engine is beyond the scope of this guide, but you can find more information in the Elasticsearch clustering documentation.)

  • Each host has its own web server; the web servers do not have to be the same.

    For example, the Commerce application can run Apache and the search engine can run nginx.

  • Both web servers use Transport Layer Security (TLS).

    Setting up TLS is beyond the scope of our documentation.

Search requests are processed as follows:

  1. A search request from a user is received by the Commerce web server, which forwards it to the search engine server.

    You configure the search engine to connect to the proxy’s host and port. We recommend the web server’s SSL port (by default, 443).

  2. The search engine web server (listening on port 443) proxies the request to the search engine server (by default, it listens on port 9200).

  3. Access to the search engine is further protected by HTTP Basic authentication. For any request to reach the search engine, it must travel over SSL and provide a valid username and password.

  4. The search engine processes the request.

  5. Communication returns along the same route, with the Elasticsearch web server acting as a secure reverse proxy.

Prerequisites

The tasks discussed in this section require the following:

Firewall and SELinux

Please take into account that security-related software (iptables, SELinux, AppArmor etc.) may be configured by default to block communication between subsystems. It may be a good idea to check them in case of problems.

Set up rules for iptables and SELinux

To set up rules to allow communication with the firewall or SELinux enabled, consult the following resources:

Install the Java Software Development Kit (JDK)

To determine if Java is already installed, enter the following command:

1
java -version

If the message java: command not found displays, you must install the Java SDK as discussed in the next section.

See one of the following sections:

Install the JDK on CentOS

See this article on digitalocean.

Be sure to install the JDK and not the JRE.

1
yum -y install java-1.8.0-openjdk

Java version 8 might not be available for all operating systems. For example, you can search the list of available packages for Ubuntu.

Install the JDK on Ubuntu

To install JDK 1.8 on Ubuntu, enter the following commands as a user with root privileges:

1
apt-get -y update
1
apt-get install -y openjdk-8-jdk

For other options, see Oracle documentation.

Install the search engine

Follow Installing Elasticsearch or Install and configure OpenSearch for your platform-specific steps.

To verify that Elasticsearch is working, enter the following command on the server on which it is running:

1
curl -XGET '<host>:9200/_cat/health?v&pretty'

A message similar to the following is displayed:

1
2
epoch      timestamp cluster       status node.total node.data shards pri relo init unassign pending_tasks
1519701563 03:19:23  elasticsearch green           1         1      0   0    0    0        0             0

To verify OpenSearch is working, enter the following commands:

1
curl -XGET https://<host>:9200 -u 'admin:admin' --insecure
1
curl -XGET https://<host>:9200/_cat/plugins?v -u 'admin:admin' --insecure

Upgrading Elasticsearch

Refer to Upgrading Elasticsearch for full instructions on backing up your data, detecting potential migration issues, and testing upgrades before deploying to production. Depending on your current version of Elasticsearch, a full cluster restart may or may not be required.

Elasticsearch requires JDK 1.8 or higher. See Install the Java Software Development Kit (JDK) to check which version of JDK is installed.

Additional resources

For additional information, see Elasticsearch documentation

Next