Meilisearch vs Elasticsearch
Are you wondering if Meilisearch is the right choice for you? Well, don't worry! We're here to help make that decision a bit easier for you. In this article, we'll break down the main strengths and weaknesses of both search engines.
Why should I consider Meilisearch over Elasticsearch?
If you are looking for a search engine that attempts to do everything from app search to log analytics, and you don’t mind spending the time and effort necessary to make it work for your search needs, then Elasticsearch might be suitable for you.
But if ease of use, performance, and relevancy are important to you, Meilisearch was made for you. Exhausted from scouring documentation pages to configure an extensive list of parameters just to deliver a decent search experience? We understand your frustration.
Let’s be honest, even if you have the most flexible and powerful tool in the world, it doesn’t count for much if it’s a pain to use and understand. That's why we made Meilisearch: to give developers the tool they need to create remarkable search experiences effortlessly.
Before making your decision, you need to understand the differences between the two engines and what you plan to use them for.
Understanding the key differences and their importance
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 that all that power comes with a high resource cost.
Elasticsearch's open-source nature has played a significant role in its popularity and adoption. And, because historically there haven't been many open-source alternatives, developers continue to go for Elasticsearch as the default solution and wind up losing a disproportionate amount of time on setup and training.
This is where Meilisearch comes in. It’s an open-source, easy-to-use, fast, relevant, and typo-tolerant search engine that fits effortlessly into any app, website, and workflow. It works out-of-the-box with default settings that meet the needs of most projects, while also being highly customizable to meet individual needs.
What is Elasticsearch made for?
Shay Bannon created Elasticsearch, a distributed search and analytics engine based on the Apache Lucene library. Elasticsearch is now developed alongside other tools for data collection, analysis, and visualization. These products are designed to be used as an integrated solution called the "Elastic Stack".
Key strengths
Elasticsearch’s main strengths lie in its flexibility and scalability, as well as its capabilities for aggregation and analysis.
Flexibility
Elasticsearch provides search and analytics for all types of data. It has extensive use cases spanning everything from simple site search, management and analysis of log data to endpoint security.
Scalability
Elasticsearch’s distributed architecture enables scalability by adding or removing nodes from the cluster, making it a suitable choice for managing large volumes of data.
Aggregation and analysis
Elasticsearch provides advanced aggregation and analytics capabilities that enable users to extract insights from their data and perform sophisticated analysis operations.
Challenges
Elasticsearch is a very powerful tool, but it’s also a very complex one. It can be arduous to set up and maintain. Since there are no defaults for implementing a basic site or app search, it needs to be configured. While Elasticsearch has extensive documentation; there is a lot to learn before jumping into implementation, which can be daunting, especially for new users.
Before you can perform your first search, there are several parameters you'll need to set up, including relevancy or typo tolerance, a must-have in a modern app or site search. It can take some time to become familiar with the process.
Let's look at an example. Given a dataset of news headlines, the request below asks for results containing “Khloe Kardashian Kendall Jenner” in the headline:
GET news_headlines/_search
{
"query": {
"match": {
"headline": {
"query": "Khloe Kardashian Kendall Jenner"
}
}
}
}
Here is Elasticsearch’s default response:
{
"_index": "news_headlines",
"_type": "_doc",
"_id": "E9CoJ3cBwsjPafpAr39g",
"_score": 17.15928,
"_source": {
"_date": "2015-05-16",
"short_description": "",
"@timestamp": "2015-05-16T00:00:00.000-06:00",
"link": "https://www.huffingtonpost.com/entry/kendall-jenner-kourtney-kardashian-height-difference_n_7297968.html",
"category": "ENTERTAINMENT",
"headline": "Kendall Jenner And Kourtney Kardashian Are Not Quite Twins In Hilarious Instagram Photo",
"authors": "Lily Karlin"
}
}
Contrary to what one might expect, the first result returned by Elasticsearch is not the most relevant; it only contains some of the search terms. As you can see in the `headline` field: it contains “Kendall Jenner”, which is expected, but instead of “Khloe Kardashian”, we find “Kourtney Kardashian”.
When a query contains multiple terms, users typically expect the search engine to prioritize results that contain all the terms rather than just some of them. In other words, users generally expect an "AND" operation rather than an "OR" when searching for multiple terms.
Elasticsearch’s match query uses the "OR" logic by default. If a document contains one of the search terms, Elasticsearch will consider that document as a hit. If we want all the query terms to be present, we have to add the “AND” operator to the query, but we’ll get far fewer results.
The other option Elasticsearch provides to tweak the relevancy is to specify the minimum number of terms a document should have to be included in the search results with the `minimum_should_match` parameter.
That’s a lot of effort for something that should be quick and painless. And we are only talking about the very basics of search.
Moreover, querying for “Kardasian”—without the `h`— returns no results. This is because Elasticsearch doesn’t allow any typos unless we set an extra parameter called `fuzziness`.
We sent the same query—with a typo—to Meilisearch:
POST /indexes/news_headlines/search
{
"q": "Khloe Kardasian Kendall Jenner"
}
With zero configuration, the first result returned by Meilisearch was:
{
"link": "https://www.huffingtonpost.com/entry/khloe-kardashian-licks-kendall-jenner-abs_us_559d7e27e4b05b1d028f98cf",
"headline": "Khloe Kardashian Licks Kendall Jenner's 'Irresistible' Abs In New Instagram Photo",
"category": "ENTERTAINMENT",
"short_description": "Khloe and Kendall shared quite the intimate moment at the gym!",
"authors": "Julia Brucculieri",
"date": "2015-07-08",
"id": 94869
}
As we saw earlier, achieving this level of relevancy with Elastic required adjusting several search parameters. So, just because you can do anything with Elasticsearch, doesn’t mean you should. In many cases, Elasticsearch might just be overkill.
What is Meilisearch made for?
Meilisearch is an open-source, user-focused search engine written in Rust. It was created in 2018 to provide an accessible search solution designed to meet a vast majority of needs, with zero configuration required and a high degree of customization.
Meilisearch delivers an instant search experience, including powerful built-in capabilities such as search-as-you-type, typo tolerance, faceted search, geo search, and multi-tenancy. Its first major version was released in early 2023, making it completely stable, forward-compatible, and enterprise-ready.
Key strengths
Meilisearch focuses on simplicity, relevancy, and performance.
Simplicity
Meilisearch aims for a simple and intuitive experience for developers. It works out of the box with no configuration needed. But you can easily tailor it to your needs in just a few minutes, so you don't have to be a search expert to get the most out of Meilisearch.
Relevancy
Meilisearch provides a pre-configured set of ranking rules, delivering high relevancy right out of the box. These default settings were developed iteratively by working directly with the community and are suitable for most use cases. These rules can be customized to suit individual requirements.
Performance
Meilisearch aims to provide a search-as-you-type experience, returning results within a maximum of 50 milliseconds.
Challenges
While it can handle a considerable amount of data, the open-source version of Meilisearch (self-hosted) may not be the best fit for applications requiring a distributed architecture to handle massive amounts of data across multiple nodes or clusters.
Meilisearch Cloud, on the other hand, already provides scalability and high availability with its Pro and Enterprise plans.
However, our team is currently gathering feedback to implement a distributed open-source Meilisearch in the near future.
Meilisearch is primarily designed to deliver performant instant-search experiences aimed at end-users and does not provide comprehensive data analysis features. While Meilisearch can help you search through your data and retrieve relevant results instantly, it has yet to offer advanced data analysis capabilities such as data visualization or statistical analysis. Meilisearch Cloud plans to provide similar features down the line, as you can see in its roadmap.
Meilisearch or Elasticsearch?
Hopefully, it’s clear by now that one search engine is not better than the other. The most important factor lies in the purpose you are using it for. Both search engines have their strengths and weaknesses, and it is essential to understand them to make the right choice for your particular use case.
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 companies with the necessary resources, whether that be the financial means to hire consultants or the time and money required to implement it themselves.
Meilisearch is a perfect choice if you need a developer-friendly tool to effortlessly deploy a typo-tolerant search, intuitive for users and return results instantly with excellent relevance out of the box. It's ideal for on-site and in-app search, including e-commerce, documentation, and content search.
Learn more about what Meilisearch can bring to your business
Conclusion
To recap, we have addressed both search engines' main strengths and weaknesses, but we have only scratched the surface. The capabilities of both search engines go far beyond what this article has covered. For a comprehensive comparison of Meilisearch with Elasticsearch and other search engines, please refer to the dedicated section in our documentation.
Do you want to see Meilisearch in action? Try our demo. You can also run it and start searching through your data in less than five minutes by following our quick start guide.
We continuously collaborate with the open-source community to develop new features and provide the best developer and search experience. See what's next on our public roadmap!
If you have any feedback or suggestions, please join our Discord server and have a chat with us!