In 2021, Elastic - the company behind ElasticSearch - announced a license change: From the Apache license to a custom Elastic License (ELV2) and a Server Side Public License. From open source to closed source. Which leaves us a question? Which should we use within Magento?
The licensing stuff
The Apache license has always been one of the main licenses to be used when open sourcing software. So with the shift, it really seems as if Elastic simply goes from open source to closed source. But that's not entirely correct. The Elastic License itself is definitely not open source.
However, the Server Side Public License was first introduced by MongoDB, then modified by Elastic and submitted to the Open Source Initiative for approval but then declined. In the OSI communications on this decline, it is discussed that the SSPL for the major part actually complies to the Open Source Definition (simply because it is pretty similar to the AGPLv3) . The additions the SSPL have made on top of the AGPL are actually even more enforcing on the open source bit than other open source licenses like the GPL. That seems good news, right?
The catch however is that anyone running SSPL-enabled software (like MongoDB and ElasticSearch) is required to release all surrounding infrastructure as SSPL (in a similar way like GPL is enforcing the GPL all around its licensed code, like a virus as Steve Balmer once mentioned) or ... get a commercial license instead. And there's the connection with the Elastic License. And there's the reason why people are moving away from ElasticSearch to OpenSearch.
The OpenSearch initiative
Confusingly enough there are two OpenSearch initiatives. One should be seen as a collection of tools created by Amazon in 2005 - we should not talk about that one here. The other one was founded in 2021, right after the license change of Elastic, and that's the fork. OpenSearch is funnily enough maintained by Amazon as well, but that's offtopic. The fork uses the Apache license again (AL 2.0) and also includes a replacement of Elastic Kibana (aka OpenSearch Dashboards).
The fork (version 1.0.0) was based on ElasticSearch 7.10.2, meaning that from that point things are evolving separately. Currently, OpenSearch is at version 2.6.0 and ElasticSearch is at version 8.7.0. As you can see with the versions, both have progressed quite a bit in two years time. So what are the differences now?
OpenSearch vs ElasticSearch
I'm not an expert here, I've read myself into this topic a bit. But I've put my Magento glasses on to filter out less important comparisons. For instance, the free version of ElasticSearch supports basic access control, the paid version of ElasticSearch adds much more, while OpenSearch adds more access control features for free. That's nice. But with Magento, ElasticSearch is mostly used as a remote storage that is more efficient in search. There will be Magento environments out there that need this access control, but all developers and agencies I've helped out in the last 5 years actually use zero access control.
Likewise there are other security features, IP filtering, cross-cluster replication, anomaly detection, all very interesting, but the majority of Magento shops out there don't look for features like these. Instead, performance seems much more important. However, from what I found, there is not a noteworthy difference in performance between the two.
A nice write-down of differences can be found here: dattell.com/data-architecture-blog/opensearch-vs-elasticsearch. But to me, this boils down to that there is not a huge difference, except for the licensing.
And then Magento
Magento 2.4.4 started to add support for OpenSearch (v1.2) so that you had a choice between ElasticSearch 7 and OpenSearch 1.2. Actually, that choice was simple: ElasticSearch 7 and OpenSearch 1.2 are compatible with each other. Interestingly, for new installs of Adobe Commerce Cloud, OpenSearch already became the default option.
With Magento 2.4.5, ElasticSearch 5 and 6 became deprecated. With Magento 2.4.6, support for ElasticSearch 8 and OpenSearch 2 was added (besides ElasticSearch 7 and OpenSearch 1.2), with the recommendation to switch to OpenSearch 2. Also, support for ElasticSearch 5 and 6 was removed (their module being gone).
With all of these updates, it has become quite common to need to upgrade ElasticSearch to facilitate a Magento upgrade. And because with Magento, all you need is (kind-of) a blank ElasticSearch/OpenSearch box, this is ok...ayish. Because is it?
With some blind spots
While Magento 2.4.6 added ElasticSearch 8 support, interestingly the module for this (composer package
magento/module-elasticsearch-8) is missing. Setting the ES8 engine during installation with flag
--search-engine=elasticsearch8 therefore fails (see GitHub issue 37236 for documentation and a great fix to get ES8 anyway).
Also, I experienced issues with people using Warden and markshust/docker-magento that upgraded to Magento 2.4.6 and found their stack suddenly not functioning.
Abrupt addition and removal of vital modules
All of this is for me a sign that the OpenSearch/ElasticSearch modules were added and/or removed almost as abrupt as the license change of ElasticSearch as well. With the flexibility of Magento, I would have loved to have seen an abstraction of search in such a way that any engine simply keeps on working for quite some time. Especially because all of this switching seems to do more with licensing than actual features.
Ah well, back to my work. I'll just change the Docker image in my development environment and will keep the swissup/module-search-mysql-legacy in production to be done with it.