# Using OpenSearch

{% hint style="info" %}
Available since `magento-scripts` 2.3.1
{% endhint %}

{% hint style="info" %}
From Magento 2.4.8 CMA will use OpenSearch as the default search engine.
{% endhint %}

## 1. Create new CMA app

```bash
npx create-magento-app@latest magento-with-opensearch
```

## 2. Set searchengine to "opensearch" in the configuration section of the config file

{% code title="cma.js" %}

```javascript
module.exports = {
    // ...other configurations
    configuration: {
        searchengine: 'opensearch' // <- set this
    }
};
```

{% endcode %}

### 2.1 Configure OpenSearch (optional)

```javascript
module.exports = {
    // ...other configurations
    configuration: {
        searchengine: 'opensearch',
        opensearch: {
            // change opensearch image here
            image: 'opensearchproject/opensearch:2.13.0',
            env: {
                // additional environment variables for container
                OPENSEARCH_JAVA_OPTS: '-Xms2048m -Xmx4096m'
            }
        }
    }
};
```

## 3. Run the application

You need to apply changes by running the [start](https://docs.create-magento-app.com/getting-started/available-commands/start) command **without** [**-s option**](https://docs.create-magento-app.com/getting-started/available-commands/start#s-skip-setup).
