3

This is one of the questions in the Magento 2 Certified Solution Specialist exam study guide. I know that the Elasticsearch and Solr are two of the most popular open source search engines and Magento Enterprise Edition (EE) version 2.x enables you to configure either of them as a catalog search engine (Solr is deprecated in Magento 2.1 and will not be supported in 2.2).

Based on magento docs each can do the followings:

Solr:

  • Faceted search
  • Dynamic clustering using SolrCloud
  • Database integration

Elasticsearch:

  • Elasticsearch performs quick and advanced searches on products in the catalog
  • Elasticsearch analyzers support multiple languages
  • Supports stop words and synonyms
  • Indexing does not impact customers until reindex is completed
  • Elasticsearch returns search results based on the last generated index until the new one has been completely indexed so there’s no disruption to customers
  • Accurate, performant, scalable
  • Works well out of the box
  • Easy to horizontally scale
  • Supports real-time data and analysis
  • Can be used as a document-oriented data store
  • Applications in framework beyond search—reporting, personalization, performance, and storage

So here is my question: As they both were built on top of the Apache Lucene open source platform, so their functionalities should be similar. Is there any main differences between Elasticsearch and Solr? What was the main problem of the Solr that now is deprecated in Magento 2.1 and will not be supported in 2.2 ?

5

As you said, Solr and Elasticsearch are both built on top of the Apache Lucene project, so what's the difference and why would Magento deprecate support for Solr in favor of Elasticsearch?

First, if you're not familiar with these tools, they are open-source search engines. They support text search (think keywords typed into your search box) among other things. Honestly, these are serious search engines and if you are planning to manage either Solr or Elasticsearch yourself, you may want to try it first as these tools are significant pieces of infrastructure. That said, they are seriously powerful and can support more nuanced search scenarios than your default full-text search in a relational database like Postgres.

The feature set of Solr and Elasticsearch is, for practical purposes, identical. Solr really excels at some more advanced search problems and has a pretty natural extension framework. Elasticsearch favors a JSON/REST API approach rather than Solr's DSL-oriented interface (although Solr is releasing more JSON/REST APIs).

For differences, Elasticsearch is maybe a little easier to use out-of-the-box, but it's not a consumer product. In fact, the simple starting cases with Elasticsearch can lead to later difficulties for newbies who may not appreciate what they're getting into. For single server instances, I would say they're roughly equivalent.

As to why Magento is pushing Elasticsearch over Solr, I think Elasticsearch's JSON interface is a little easier to learn quickly, and its deployment story requires less operational skill than Solr.

In either case, if you're considering a different search engine for Magento you should consider some of the managed services for Elasticsearch (or Solr) rather than managing the servers yourself, as that is a whole skill in itself.

1

I found this answer helpful by SwiftOtter:

  • Elasticsearch allows multiple types of documents in an index. Solr requires you to do the work at the application level.
  • Elasticsearch is more configurable on the fly.
  • Elasticsearch supports complex nested types.
  • Solr supports grouping, but Elasticsearch doesn’t.
  • Read this blog comparing Elasticsearch and Solr.

Also according to this review of the differences between Apache Solr and ElasticSearch , Elasticsearch is the only true option for cloud and distributed environments. Elasticsearch is scalable, lightning fast, and a breeze to integrate with. Its API is more intuitive and accessible than Solr’s.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.