What are the main differences between MeiliSearch and Elasticsearch, and why do they matter?
Since its creation in 2010, Elasticsearch has quickly become a popular option in the search engine market, finding use in all kinds of applications and datasets. However, while it is undeniably a powerful tool for heavy full-text search, the need for extensive configuration before use means all that power comes with a high resource cost.
For big tech companies dealing with enormous logs, Elasticsearch might make sense. But when it comes to medium-size datasets (i.e. less than five million rows) and smaller apps, it simply isn’t right for the job. Nonetheless, since no open-source alternative has historically been available, developers still go for Elastic as their default solution and wind up losing a disproportionate amount of time on setup and training.
This is where MeiliSearch comes in. Offering a fast, relevant, and typo-tolerant search with little-to-no setup time, MeiliSearch is a great solution for any developer who needs a powerful and accessible search engine focused on end-users.
Let's dig into these search engines and their use cases!
1 - What is Elasticsearch made for?
A little bit of history
In 2010, Shay Bannon introduced the first version of Elasticsearch, a distributed search engine written in Java. Built on top of Lucene—a project started by Doug Cutting in 1999 after writing four other search engines for companies like Apple—it is suitable for nearly any application that requires full-text search.
While Lucene is what’s under the hood, Elasticsearch provides a higher-level interface for its users: an HTTP API that consumes JSON documents. It also offers out-of-the-box scalability through sharding and replication. With the addition of data-processing and visualization software, Elasticsearch is now provided as a fully-integrated solution for data management, monitoring, and search. Enter the “ELK stack”.
With great power comes great complexity
The use cases for Elasticsearch are very wide, spanning everything from simple site search to analysis of massive datasets.
But just because you can do anything with Elastic doesn’t mean that you should. In order to configure Elasticsearch to a specific application usage, developers have to learn quite a bit about how the engine works. Of course, Elasticsearch provides training—but for a price.
Elasticsearch is very powerful when it comes to massive datasets; it can quickly scale horizontally and allows one to build complex queries. The flipside of that is that nothing is easy. Even if all you need is simple search functionality that handles typos, synonyms, or filters, you're looking at hours of training, documentation, and configuration. That’s a lot of resources for something that should be quick and painless, which is why many companies hire Elasticsearch consultants to speed up the process. Do you see a pattern here?
2 - What is MeiliSearch made for?
MeiliSearch is an open-source search API written in Rust, a performant and reliable programming language. Created in 2018 by Quentin Dequelen and Clement Renault, a Rust contributor, it delivers extremely high performance while also allowing developers to have granular control over every memory allocation.
With data structures and algorithms heavily inspired by Algolia, MeiliSearch aims to offer the best possible performance for instant search. Rather than attempting to replicate the raw power of Elasticsearch or Lucene, MeiliSearch is built for lightning-fast deployment, with search-as-you-type functionality right out of the box.
We want MeiliSearch to become the go-to solution for end-user search. To that end, there are three important factors to consider: speed, ease of use, and ease of installation.
MeiliSearch is designed to answer in less than 50 milliseconds. This speed threshold is important because it allows users to respond to the search in real-time, narrowing their search terms or stopping early if they’ve found what they’re looking for.
It might only save a few seconds per search, but those few seconds represent a huge efficiency boost for users. In all cases, less time searching and more time browsing means more clicks, better sales, or increased productivity for your product.
B. Ease of use for the end user
Along with instant search, MeiliSearch offers a typo-tolerant, natural query language.
This makes the search engine feel simple and intuitive. It’s all too common for search bars to make users feel like they have to learn a new language just to get the best results—or worse, that they have to jump back and forth between their search and Google just to get the right spelling or product UID. MeiliSearch makes searching simple and responsive, so the user can stay focused on the results.
Since MeiliSearch is configured to the needs of the end-user, synonyms can be used in search and redundant words like “the” and “a” can be ignored from results.
C. Ease of use for developers
MeiliSearch provides an extensive toolset for customization, including synonyms, stop-words, ranking rules, and more. But unlike with other search engines, these customization options are just that: optional.
MeiliSearch works out-of-the-box with a preset that easily answers the needs of most applications.
For MeiliSearch, we chose a RESTful API because most developers are already familiar with its norms.
D. How to install MeiliSearch?
Sometimes, a gif is worth a thousand words.
As you can see, with only two commands, we have a MeiliSearch server up and running.
Next, we will add documents to the server. For this example, we’re using a movie dataset that you can download here.
With our first command, we create an index. Then, we add the movie dataset, containing over 20,000 movies, to that index. After that, we make a search request using the query “scoutt”, which returns Scott Pilgrim vs. the World as well as Scouts Guide to the Zombie Apocalypse.
This example is made with cURL in order to showcase the RESTful API, but it’s just as easy to do with any of our SDKs. Simply head to the repository in question, where an example can be found in the README.
3 - MeiliSearch or ElasticSearch?
Hopefully it’s clear by now that the important question isn’t which search engine is better—the important question is, what are you using your search engine for?
MeiliSearch is not made to search through billions of large text files or parse complex queries. This kind of searching power would require a higher degree of complexity and lead to slower search experiences, which runs against our instant search philosophy. For those purposes, look no further than Elasticsearch; it’s an excellent solution for the companies that have the resources to implement it.
On the other hand, if you want a frictionless search experience for your end-users, or use a dataset that contains a lot of keywords (e.g. e-commerce, catalogs, documentation, ...), MeiliSearch is the clear winner.
With MeiliSearch, we focused on the simple things in order to provide a state-of-the-art search engine at a fraction of the cost.
Developing an app or site? Our product offers smaller developer teams the same quality of search as big tech companies like Amazon or Google, without requiring you to pay for expensive retraining or consulting.
Give MeiliSearch a try! You can deploy an instance of the search engine in minutes using your favorite tool. Documentation is available at docs.meilisearch.com.
As we are still refining the API, please do not hesitate to let us know what you think. Our preferred method of communication is our forum on GitHub Discussions. But if you prefer the speed and fluidity of chat, join our Slack community.