> ## Documentation Index
> Fetch the complete documentation index at: https://perfgrid.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Configure ES/OpenSearch for Magento 2.4

When you install Magento 2.4, it's a requirement you set up ElasticSearch / OpenSearch, since this is used for the search catalog in Magento 2.4.

You can either buy access to an ElasticSearch / OpenSearch index via our site, or any hosted ElasticSearch.

You can either configure ElasticSearch / OpenSearch from the GUI or from the command-line.

## Via the GUI:

First navigate to Stores -> Settings -> Configuration -> Catalog -> Catalog -> Catalog Search.

By default, you'll see the following:

![Magento 2.4 Catalog Search Configuration](https://perfgrid-guides.s3.eu-west-par.io.cloud.ovh.net/MtL7IGiEmt0dHpyQkHQ8K7QBQ.png)

What we're going to put here is:

Elasticsearch Server Hostname: `https://elasticsearch-shared.h4r.eu` (Keep in mind `https://` is very important here!)

Elasticsearch Server Port: `443`

Elasticsearch Index Prefix: `<your_index>`

Enable Elasticsearch HTTP Auth: `Yes`

Elasticsearch HTTP Username: `<user_username>`

Elasticsearch HTTP Password: `<user_password>`

![Magento 2.4 Catalog Search Configuration](https://perfgrid-guides.s3.eu-west-par.io.cloud.ovh.net/tyoFEwhbKzS0HBWCLH0HTTdrv.png)

Click on Save, and you should now be ready to go!

## Via the command-line:

To do it via CLI, you'll have to go to the installation directory of Magento (Often public\_html) and do the following

```bash theme={null}
$ php bin/magento config:set catalog/search/elasticsearch7_server_hostname 'https://elasticsearch-shared.h4r.eu'
$ php bin/magento config:set catalog/search/elasticsearch7_server_port 443
$ php bin/magento config:set catalog/search/elasticsearch7_enable_auth 1
$ php bin/magento config:set catalog/search/elasticsearch7_username username
$ php bin/magento config:set catalog/search/elasticsearch7_password password
$ php bin/magento config:set catalog/search/elasticsearch7_index_prefix index_name
$ php bin/magento setup:upgrade
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.