Codementor Events

ElasticSearch vs Algolia

Published Sep 13, 2017Last updated Mar 11, 2018

A few months ago, working @Previando, a social network that connects groups of friends, I needed to speed-up the search of the groups.

I had two options: Algolia and ElasticSearch.

I had used Algolia in an e-commerce application, it is a very good product and here are some points to take into account:

Advantages:

  • Multiple back-end SDKs to make it easier to keep the indexes synchronized.
  • Front-end SDKs to develop your search
  • Easy and fast to implement.
  • Easy to make query searches from the front-end

Disadvantage:

  • Expensive, it’s pricing model is based on the numbers of records stored and by the amount of operations made to the API.

Today, you have a free plan starting from 10k records and 100k operations, but if you wish to have more records or need to do more operations the starting plan is starts at 35$ per month, and it increase 25$ per 50k records and 10$ per 100k operations. So if you have a large data set, Algolia is not for you.

It is an amazing product!

Now, let’s talk a bit about ElasticSearch. ElasticSearch was new for me, but it was very similar to Algolia, although more work is needed to understand how to use it and how to integrate it.

Advantages:

  • Like Algolia, has multiples back-end SDKs to keep the indexes synchronized.
  • Also, it have front-end SDKs.
  • Chepear than Algolia when you expect having a great number of records, like 500k at least.
  • Analyze the data with Kibana.

Disadvantage:

  • Harder to integrate. More work is needed to keep the indexes synchronized.
  • Define the data types of the index’s attributes.
  • Understand how to make the queries. A complex query is huge JSON.

Let’s talk about the pricing of ElasticSearch, it depends on where do you use it. Nowadays there are three posibilites:

  1. AWS ElasticSearch.
  2. ElasticSearch as a service from Elastic Cloud.
  3. Manually deployed to your own servers.

Of course, any of these has its advantages and disadvantages. Obviously the third is the cheapest and most difficult solution. I would not go with the third solution unless I am spending too much on AWS or on Elastic Cloud.

If you are not going for the third option, the solution would be Elastic Cloud or AWS, this post from Elastic has a detailed break down.

I would choose Algolia if the records that I planned to have are less than 400k, that is because of their pricing, is a little bit high. You can use their awsome calculator.

The key factor for us was the price, that’s why we chose ElasticSearch hosted on Elastic Cloud.

If you choose to use, you should start reading the documentation, here are some usefull links:

If you are using Rails like me, some of the gems listed here may be useful to you.

On the next post I will share how I integrated ElasticSearch with my rails Application! So stay tuned for more 😃

I hope you enjoy reading this post, as much as I enjoyed writing it!

Discover and read more posts from Mariano Matayoshi
get started