OpenSearch / Elasticsearch
MageBox supports both OpenSearch and Elasticsearch for Magento catalog search, with automatic plugin installation.
Configuration
OpenSearch (Recommended)
services:
# Simple format (uses default 1GB memory)
opensearch: "2.19"
# Extended format with memory allocation
opensearch:
version: "2.19"
memory: "2g" # Recommended for production-like performanceElasticsearch
services:
# Simple format
elasticsearch: "8.11"
# Extended format
elasticsearch:
version: "8.11"
memory: "2g"You can also use major-version shorthands. For example, elasticsearch: "7" resolves to the latest available 7.x image, elasticsearch: "8" resolves to the latest available 8.x image, and opensearch: "2" resolves to the latest available 2.x image. If you specify an exact supported minor such as 8.11, MageBox keeps that minor and only resolves the patch release.
TIP
OpenSearch is recommended for new projects. It's fully compatible with Elasticsearch and is the default for Magento 2.4.6+.
Automatic Plugin Installation
MageBox automatically installs the required Magento plugins:
| Plugin | Description |
|---|---|
| analysis-icu | International Components for Unicode (ICU) analyzer |
| analysis-phonetic | Phonetic token filter for soundex and metaphone algorithms |
These plugins are required by Magento for proper search functionality and are installed automatically when the container starts.
Memory Configuration
By default, search engines are allocated 1GB of RAM. For better performance:
services:
opensearch:
version: "2.19"
memory: "2g" # 2GB for production-like performanceRecommended settings:
- Development:
1g(default) - Production-like testing:
2g - Large catalogs:
4g
Connection Details
| Property | Value |
|---|---|
| Host | 127.0.0.1 |
| Port (OpenSearch) | 9200 |
| Port (Elasticsearch) | 9500 |
| Protocol | http |
Each engine runs as a single shared container on a fixed port. OpenSearch and Elasticsearch use different ports so both can run at the same time.
Upgrading from MageBox 1.x
Before 2.0, MageBox ran one search container per requested version, each on a version-derived host port — OpenSearch 2.19 on 9259, Elasticsearch 7.17 on 9657, and so on. From 2.0 there is a single container per engine on a fixed port: OpenSearch on 9200, Elasticsearch on 9500.
After upgrading:
Point Magento at the new port. Any project configured against a version-derived port must be updated to
9200(OpenSearch) or9500(Elasticsearch):bashphp bin/magento config:set catalog/search/opensearch_server_port 9200 php bin/magento cache:flushProjects already on
9200— which MageBox additionally mapped when only one search service was configured — need no change.Reindex. The new container uses a fresh volume, so it starts empty:
bashphp bin/magento indexer:reindex catalogsearch_fulltextRemove the old containers and volumes. They are orphaned after the upgrade and keep consuming disk and memory. The old names carry the version they were created for, so list them before removing:
bash# Old containers: magebox-opensearch-2.19.4, magebox-elasticsearch-7.17, … docker ps -a --format '{{.Names}}' | grep -E 'magebox-(opensearch|elasticsearch)-' # Old volumes: magebox_opensearch2194_data, magebox_elasticsearch717_plugins, … docker volume ls --format '{{.Name}}' | grep -E 'magebox_(opensearch|elasticsearch)[0-9]+_'Then remove what those two commands list:
bashdocker rm -f magebox-opensearch-2.19.4 docker volume rm magebox_opensearch2194_data magebox_opensearch2194_pluginsThe new shared containers (
magebox-opensearch,magebox-elasticsearch) and their volumes (magebox_opensearch_data, …) carry no version digits, so the patterns above never match them.
Only rebuildable search indices live in these volumes, so nothing needs to be backed up first.
Magento Configuration
Use your project name as index prefix
MageBox projects share a single OpenSearch/Elasticsearch Docker instance (OpenSearch on port 9200, Elasticsearch on port 9500). Using the same prefix (e.g. magento2) across projects causes index collisions — one project's reindex will overwrite another's data. Always set the prefix to your project name.
OpenSearch
Via CLI:
php bin/magento config:set catalog/search/engine opensearch
php bin/magento config:set catalog/search/opensearch_server_hostname 127.0.0.1
php bin/magento config:set catalog/search/opensearch_server_port 9200
php bin/magento config:set catalog/search/opensearch_index_prefix myprojectOr in app/etc/env.php:
'system' => [
'default' => [
'catalog' => [
'search' => [
'engine' => 'opensearch',
'opensearch_server_hostname' => '127.0.0.1',
'opensearch_server_port' => '9200',
'opensearch_index_prefix' => 'myproject',
'opensearch_enable_auth' => '0',
'opensearch_server_timeout' => '15'
]
]
]
]Elasticsearch 7
'system' => [
'default' => [
'catalog' => [
'search' => [
'engine' => 'elasticsearch7',
'elasticsearch7_server_hostname' => '127.0.0.1',
'elasticsearch7_server_port' => '9500',
'elasticsearch7_index_prefix' => 'myproject',
'elasticsearch7_enable_auth' => '0',
'elasticsearch7_server_timeout' => '15'
]
]
]
]Elasticsearch 8
'system' => [
'default' => [
'catalog' => [
'search' => [
'engine' => 'elasticsearch8',
'elasticsearch8_server_hostname' => '127.0.0.1',
'elasticsearch8_server_port' => '9500',
'elasticsearch8_index_prefix' => 'myproject',
'elasticsearch8_enable_auth' => '0',
'elasticsearch8_server_timeout' => '15'
]
]
]
]Reindexing
After configuring search, reindex the catalog:
php bin/magento indexer:reindex catalogsearch_fulltextSupported Versions
OpenSearch
- 2.19.x (latest, recommended)
- 2.x series
Elasticsearch
- 8.11 (for Magento 2.4.6+)
- 7.17 (for Magento 2.4.4+)
Common Operations
Check Cluster Health
curl http://127.0.0.1:9200/_cluster/health?prettyList Indices
curl http://127.0.0.1:9200/_cat/indices?vView Index Mapping
curl http://127.0.0.1:9200/magento2_product_1/_mapping?prettyDelete All Indices
curl -X DELETE http://127.0.0.1:9200/magento2_*Then reindex:
php bin/magento indexer:reindex catalogsearch_fulltextCheck Installed Plugins
curl http://127.0.0.1:9200/_cat/pluginsShould show analysis-icu and analysis-phonetic.
Troubleshooting
Connection Refused
Check if the container is running:
docker ps | grep -E "opensearch|elastic"Start services:
magebox global startSearch Not Working
- Verify the search engine is configured:
php bin/magento config:show catalog/search/engine- Check the service is accessible:
curl http://127.0.0.1:9200- Reindex:
php bin/magento indexer:reindex catalogsearch_fulltextIndex Not Found
If you see "index not found" errors:
# Delete stale indices
curl -X DELETE http://127.0.0.1:9200/magento2_*
# Reindex
php bin/magento indexer:reindex catalogsearch_fulltextMemory Issues
OpenSearch/Elasticsearch requires significant memory. Check container resources:
docker statsIncrease memory allocation in your config:
services:
opensearch:
version: "2.19"
memory: "2g" # Increase from default 1gThen restart:
magebox restartPlugin Missing Error
If Magento reports missing ICU or Phonetic plugin:
- Check plugins are installed:
curl http://127.0.0.1:9200/_cat/plugins- Restart the search container:
docker restart $(docker ps -qf "name=opensearch")- If still missing, recreate the container:
magebox stop
magebox startSlow Indexing
For faster indexing:
- Increase PHP memory limit
- Use batched indexing
- Increase search engine memory
- Disable real-time indexing during initial setup
# Set to manual mode for bulk operations
php bin/magento indexer:set-mode schedule catalogsearch_fulltext
# After bulk import, reindex manually
php bin/magento indexer:reindex catalogsearch_fulltext
# Restore real-time
php bin/magento indexer:set-mode realtime catalogsearch_fulltextSwitching Search Engines
To switch from Elasticsearch to OpenSearch:
- Update
.magebox.yaml:
services:
# elasticsearch: "7.17" # Remove
opensearch: # Add
version: "2.19"
memory: "2g"- Restart services:
magebox stop
magebox start- Update Magento config:
php bin/magento config:set catalog/search/engine opensearch
php bin/magento config:set catalog/search/opensearch_server_hostname 127.0.0.1
php bin/magento config:set catalog/search/opensearch_server_port 9200- Reindex:
php bin/magento indexer:reindex catalogsearch_fulltextElasticvue Web UI
MageBox can run Elasticvue, a browser-based UI for inspecting your search engine.
# Enable
magebox elasticvue enable
# Access at http://localhost:8090
# Add cluster URI: http://localhost:9200See the OpenSearch service docs for details.
Performance Tips
Allocate sufficient memory - At least 1GB for development, 2GB for production-like testing
Use SSD storage - Search indices benefit greatly from fast disk I/O
Index only necessary attributes - Review which attributes are searchable
Use index prefixes - Separate indices per environment to avoid conflicts
Monitor cluster health - Regularly check for yellow/red status