Magento 2 and OpenSearch: Best Practices for Store Search Optimization
Magento 2 OpenSearch optimization is essential for improving store search performance and delivering accurate product results. In this guide, we’ll explore best practices for configuring search weight, stop words, and synonyms to enhance user experience and boost conversions.
What is OpenSearch in Magento 2?
OpenSearch is an open-source search and analytics suite, fully API-compatible with Elasticsearch. Magento 2.4.x supports OpenSearch natively, making it the recommended engine for:
- Catalog search
- Product indexing
- Faceted navigation
- Real-time analytics
Why Use OpenSearch Instead of Elasticsearch?
Open-source governance → No licensing concerns.
Compatibility → Fully works with Magento 2’s search module.
Scalability → Handles large catalogs and high-traffic stores.
Flexibility → Plugins and integrations supported by the community.
Step 1: Configure OpenSearch in Magento 2
After installing OpenSearch on your server, connect Magento 2:
1. Go to Admin Panel → Stores → Configuration → Catalog → Catalog Search

2. Enter your OpenSearch host details:

- Host:
localhost - Port:
9200
Example configuration:
{
"host": "localhost",
"port": "9200",
"index_prefix": "magento2"
}
3. Test the connection and save configuration.

Step 2: Optimize Indexing for Faster Performance
Use separate indexes for products, categories, and CMS pages.
Enable asynchronous indexing to avoid performance drops during peak hours:
php bin/magento indexer:set-mode schedule
Run cron jobs regularly to keep indexes fresh.
Step 3: Improve Search Relevance
Beyond the default Magento 2 search integration, you can fine-tune OpenSearch to deliver highly relevant results:
1. Adjust Search Weight
- Navigate to Stores → Attributes → Product.
- Open an attribute (e.g., name, sku, description).
- Enable Use in Search → set Search Weight (higher values mean higher relevance).
- Example: Product Name = 10, SKU = 8, Description = 3.

2. Configure Stop Words
Reduce noise in queries by ignoring common words like the, a, of.
In OpenSearch, add a stopword filter:
"analysis": {
"filter": {
"english_stop": {
"type": "stop",
"stopwords": ["the", "a", "an", "of", "in"]
}
}
}
Result: “The iPhone 15” = “iPhone 15” for better accuracy.
3. Add Synonyms
Map related terms to unify search results.
Example synonyms.txt:
t-shirt, tee
cellphone, smartphone
laptop, notebook
Apply synonyms filter in your OpenSearch index, then reindex in Magento.
With these tweaks, store search results become more intuitive, reducing bounce rate and improving conversion.
Magento 2 and OpenSearch work seamlessly to deliver powerful, scalable, and fast product search. By applying best practices—like fine-tuning relevance, optimizing indexes, and monitoring performance—you can significantly improve store search optimization and boost customer satisfaction.
This is the end of the Magento 2 And OpenSearch: Best Practices For Store Search Optimization.
You can read more useful articles like Best Practices for Handling Secrets in Docker.
Follow us for the more helpful posts!
We hope this is a useful post for you.