Fast search for large catalogues: how UK merchants connect Elasticsearch or OpenSearch to Shopware 6, from installation and configuration to indexing, testing and operations.
In e-commerce, search speed and result quality make a big difference to customer satisfaction and conversion, and UK shoppers are quick to leave a shop whose search returns nothing useful. Shopware 6 comes with an integration for Elasticsearch and OpenSearch: distributed search engines that search large catalogues in milliseconds, calculate filters and facets, and deliver suggestions as you type.
Shopware’s default search runs on the MySQL database. That is fine for small product ranges, but it gets slow with tens of thousands of products, many properties and high traffic. Elasticsearch or OpenSearch then take over product search, listings and filtering in the storefront and the Store API.
This article covers prerequisites, installation, configuration, indexing, testing and operations. For platform basics, see our page on Shopware development.
Elasticsearch is a distributed search and analytics engine based on the Lucene library. It indexes documents, answers full-text and structured queries with low latency, and scales across multiple nodes. It was developed by Elastic.
After Elastic’s licence change in 2021, Amazon Web Services released OpenSearch, a fork of Elasticsearch and Kibana. OpenSearch is licensed under Apache 2.0, is developed by a community and remains compatible with the most important APIs. Shopware supports both systems and recommends OpenSearch for new installations.
Once the integration is active, product search, category listings and filters run through the search index instead of SQL. The Administration can also use its own admin search powered by the engine. Which route makes sense depends on your catalogue, traffic and hosting; our overview of Shopware hosting helps you weigh up the options.
# Download the package (adjust the version)
wget https://artifacts.opensearch.org/releases/bundle/opensearch/2.19.0/opensearch-2.19.0-linux-x64.deb
# Install; since OpenSearch 2.12 an admin password is required
sudo env OPENSEARCH_INITIAL_ADMIN_PASSWORD=YourSecurePassword dpkg -i opensearch-2.19.0-linux-x64.deb
# Start the service and enable it at boot
sudo systemctl enable --now opensearch
# Check that it is reachable
curl -k -u admin:YourSecurePassword https://localhost:9200/
For Elasticsearch, installation works the same way with the Elastic package and the elasticsearch service. In development environments, a Docker container is the quickest to set up. In production, adjust the heap size (about half of the available RAM, at most 31 GB), storage paths and credentials in the configuration.
The integration is not controlled in the Administration but via environment variables in .env or .env.local:
SHOPWARE_ES_ENABLED=1
SHOPWARE_ES_HOSTS=https://user:password@localhost:9200
SHOPWARE_ES_INDEXING_ENABLED=1
SHOPWARE_ES_INDEX_PREFIX=sw
SHOPWARE_ES_THROW_EXCEPTION=0
What the variables do: SHOPWARE_ES_ENABLED turns on search via the engine, SHOPWARE_ES_INDEXING_ENABLED allows writing to the index, SHOPWARE_ES_INDEX_PREFIX separates several shops on one cluster, and SHOPWARE_ES_THROW_EXCEPTION determines whether an outage shows an error (1) or Shopware silently falls back to database search (0).
bin/console cache:clear
bin/console es:index
bin/console es:create:alias
bin/console es:status
For the first run, we recommend this order: turn on indexing but leave search off, build the index, then set SHOPWARE_ES_ENABLED=1 and clear the cache. That keeps the shop available during indexing. Indexing runs through the message queue, so the worker must be running. Later, use bin/console dal:refresh:index to trigger a full reindex.
With SHOPWARE_ADMIN_ES_ENABLED=1 and SHOPWARE_ADMIN_ES_INDEXING_ENABLED=1, search in the Administration also uses the engine. Build its index with bin/console es:admin:index.
curl -k -u user:password https://localhost:9200/_cluster/health should report green or yellow (yellow is normal for a single node).bin/console es:status shows indexes, alias and document count. The number of products should match your catalogue.var/log/prod.log) and the search engine logs for errors.SHOPWARE_ES_HOSTS; for self-signed certificates, add the CA.bin/console es:reset lets you rebuild a corrupted index.es:status), clear the cache and verify that SHOPWARE_ES_ENABLED is really set to 1.Can I switch freely between Elasticsearch and OpenSearch?
In principle, yes; Shopware addresses both through the same configuration. But check the supported versions in the release notes for your Shopware version.
My hosting provider does not offer a search engine. What now?
Use a managed service such as Amazon OpenSearch Service or Elastic Cloud (ideally in a UK or EU region), or stick with database search until your catalogue requires it. Our article on Shopware hosting shows the available options.
How often do I need to reindex?
Shopware updates the index automatically via the worker when data changes. A full reindex makes sense after Shopware updates, changes to properties or changes to the index configuration.
Can I adjust result weighting?
Yes. You set the weighting of search fields in the Administration under Settings → Search, and more advanced boosting rules can be added via a plugin. To learn how we build these, see our page on Shopware plugin development.
Want to know whether switching is worth it for your UK shop? Our shop audit checks search, performance and conversion.