Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Elastic Search vs Sunspot comparison on features

Couden't find any compare questions related to sunspot (Solr) to Elastic Search (Lucene) What would be the pro's and con's on both search engines?

I saw other VS questions to get a better inside in the comparisment of 2 gems so hope this is allowed to get a better insight in the both engines for newbies ( like me ). I have looked at sunspot already but have some issues with it. So I searched

  • http://www.elasticsearch.org/guide/reference/api/

vs

  • http://sunspot.github.com/
like image 820
Rubytastic Avatar asked Feb 06 '12 12:02

Rubytastic


People also ask

What is the main architectural difference between Elasticsearch and Solr?

1 Ingest and Query services. The Elasticsearch query process is structured very similarly to the Solr service. The main difference lies in the microservice architecture of the system, and the exits to the Elasticsearch and the ZooKeeper administrative functions, rather than to Solr and the monolithic search server.

Why Elasticsearch is better than Solr?

Solr has more advantages when it comes to the static data, because of its caches and the ability to use an uninverted reader for faceting and sorting – for example, e-commerce. On the other hand, Elasticsearch is better suited – and much more frequently used – for timeseries data use cases, like log analysis use cases.

Is Solr faster than Elasticsearch?

Performance-wise, they are roughly the same. Operationally, Elasticsearch is a bit simpler to work with, it has just a single process. Solr, in its Elasticsearch-like fully distributed deployment mode known as SolrCloud, depends on Apache ZooKeeper.

Is Elasticsearch based on Lucene?

Lucene or Apache Lucene is an open-source Java library used as a search engine. Elasticsearch is built on top of Lucene. Elasticsearch converts Lucene into a distributed system/search engine for scaling horizontally.


2 Answers

I started working on a project that needed full text search in Ruby so naturally I started with Solr + Sunspot, but I couldn't get it to work. It was a pain just the get them connected, then tried to figure out if the document indexed correctly, figure out the runtime classpath so I can add additional analyzer/tokenizer classes, editing config.xml/schema.xml, etc. Solr numDocs clearly said it received and indexed them but I couldn't get any query results. I just gave up after a couple days, it was kind of a configuration hell.

ElasticSearch + Tire was a breezy to get it up and running, I got it working in an hour.

Lucene is just a Java search library, hence Solr was developed to be a full service search app, but Solr still have all the trapping of a typical Java webapp: overly complicated XML configurations, schema-heavy, expect XML docs for indexing, requires a Java servlet container (Jetty or Tomcat), which just become too many points of failure for me.

ElasticSearch is based on Lucene too, it has a built-in servlet container so just run like a daemon, use a very straight forward JSON + REST API so it's great for testing and a more natural fit for Ruby. It's schemaless and it worked for me without even editing a config file. Everything worked beautifully.

What I really needed was Chinese search and ElasticSearch already packaged Luecene's SmartChineseAnalyzer as a plugin. Not sure how difficult it will be to customize the analyzer/tokenizer chain if you need that level of customization. Docmentation for ElasticSearch and Tire are both top-notch.

Tire (Ruby library for ElasticSearch)

https://github.com/karmi/tire

You can try out the demo, it'll install a rails searchapp, download the ElasticSearch binary and run it, then start Webrick automatically.

$ rails new searchapp -m https://raw.github.com/karmi/tire/master/examples/rails-application-template.rb

On my system it complained about not having a Javascript engine (Rails 3.2? no longer include thereubyracer gem by default), so I had to:

$ wget https://raw.github.com/karmi/tire/master/examples/rails-application-template.rb
$ nano rails-application-template.rb

add gem 'therubyracer' in the file (look for gem 'tire' and gem 'will_paginate'), then...

$ rails new searchapp -m rails-application-template.rb

For developing my own app, I just downladed the ElasticSearch tarball and run in the foreground with the -f switch (so I can easily stop it by Ctrl-C)

$ bin/elasticsearch -f

You can install the eleasticsearch-head plugin to get a web admin interface

https://github.com/mobz/elasticsearch-head

Also something I found out: if you have one-to-many relationship models, Tire won't resolve them for you in the search results, it just returns a flat collection. Your has_many and belongs_to relationships will just be object ids in the collection rather than full objects.

like image 88
goofrider Avatar answered Sep 25 '22 23:09

goofrider


I think you should search for a comparison between Solr and elastic search. In fact sunspot is based on Solr, and both Solr and elastic search are based on Lucene. They are two different projects with similar goals, both built on top of Lucene.

Here are two comparisons:

ElasticSearch, Sphinx, Lucene, Solr, Xapian. Which fits for which usage?

http://www.findbestopensource.com/article-detail/solr-vs-elasticsearch

like image 35
javanna Avatar answered Sep 24 '22 23:09

javanna