Getting Started with Meilisearch: Fast Search for Your Apps
Rijul Rajesh

Rijul Rajesh @rijultp

About: Dev | Technical Writer | Learner | Powered by ☕ and 🐧 Building https://hexmos.com/livereview

Joined:
Nov 12, 2023

Getting Started with Meilisearch: Fast Search for Your Apps

Publish Date: Sep 10
1 0

When you build an application that has a lot of content, one of the first requests you will hear from users is “can you make search better?” Nobody enjoys typing into a search box and waiting for slow or irrelevant results. This is where Meilisearch comes in. It is an open source search engine that is fast, lightweight, and developer friendly.

What is Meilisearch

At its core, Meilisearch is a search engine you can self-host or run in the cloud. It is designed to provide instant search results, similar to what you see in modern apps like Notion or marketplaces like Airbnb. The focus is on speed, relevance, and ease of integration.

Unlike heavy solutions such as Elasticsearch or Solr, Meilisearch is built to be simple to install and run. You can get it up and running in just a few minutes without complex configuration.

Why Developers Like It

There are a few reasons Meilisearch has become popular among developers:

  • Blazing fast results: It is optimized for instant search. Queries feel real time even with large datasets.
  • Easy to use API: You interact with it through a RESTful API. Adding documents, searching, and customizing ranking rules are all done through simple endpoints.
  • Great relevance out of the box: Meilisearch comes with sensible defaults for ranking and typo tolerance. This means you spend less time tuning and more time building.
  • Lightweight and open source: It is written in Rust, which makes it efficient and safe, and you can run it almost anywhere.

Installing Meilisearch

Getting started locally is very straightforward. You can download a prebuilt binary or run it with Docker. For example, with Docker:

docker run -it --rm \
    -p 7700:7700 \
    getmeili/meilisearch
Enter fullscreen mode Exit fullscreen mode

This spins up a server at http://localhost:7700. From here, you can send requests to add documents or perform searches.

Adding and Searching Data

Let’s say you want to index a list of books. You can add them by sending a simple request:

curl \
  -X POST 'http://localhost:7700/indexes/books/documents' \
  -H 'Content-Type: application/json' \
  --data-binary '[
    { "id": 1, "title": "Pride and Prejudice", "author": "Jane Austen" },
    { "id": 2, "title": "The Great Gatsby", "author": "F. Scott Fitzgerald" }
  ]'
Enter fullscreen mode Exit fullscreen mode

Then you can search:

curl \
  -X POST 'http://localhost:7700/indexes/books/search' \
  -H 'Content-Type: application/json' \
  --data-binary '{ "q": "gatsby" }'
Enter fullscreen mode Exit fullscreen mode

The response will return matching documents almost instantly.

Customization

While the defaults are great, Meilisearch also gives you control. You can adjust ranking rules, configure stop words, enable synonyms, and set filters. For example, if you want to let users filter books by author, you can set author as a filterable attribute.

This level of customization makes it suitable for building powerful search features without writing a lot of complex logic yourself.

Adding SEO Keywords Inside Meilisearch

One of the best ways to improve search relevance is to treat your document fields like SEO fields. The more descriptive and keyword-rich your data, the better the search experience for users. Here are some practical ways to do that:

  1. Create a keywords field When adding documents, include a field that contains alternate terms, synonyms, or related phrases. For example, if you index a book about “Pride and Prejudice,” you can add keywords like “classic novel,” “romance,” or “Regency literature.”
   {
     "id": 1,
     "title": "Pride and Prejudice",
     "author": "Jane Austen",
     "keywords": ["classic", "romance", "Regency", "English literature"]
   }
Enter fullscreen mode Exit fullscreen mode

Then configure Meilisearch so that keywords is part of the searchable attributes.

  1. Use synonyms for common terms Meilisearch supports a synonym list. If users search for “romcom,” you can map it to “romance comedy.” This improves recall without duplicating data.
   curl \
     -X POST 'http://localhost:7700/indexes/books/settings/synonyms' \
     -H 'Content-Type: application/json' \
     --data-binary '{
       "romcom": ["romance comedy", "romantic comedy"],
       "sci-fi": ["science fiction"]
     }'
Enter fullscreen mode Exit fullscreen mode
  1. Leverage filterable and sortable attributes
    SEO-style keywords are not only about matching text but also about letting users refine results. Add attributes like genre, tags, or topics as filterable so searches can combine full text queries with structured filters.

  2. Boost important fields with ranking rules
    By default, Meilisearch ranks matches in title higher than in other fields. You can customize this by reordering the ranking rules. For example, you might want keywords to have a higher priority than description.

   curl \
     -X POST 'http://localhost:7700/indexes/books/settings' \
     -H 'Content-Type: application/json' \
     --data-binary '{
       "rankingRules": [
         "typo",
         "words",
         "proximity",
         "attribute",
         "exactness",
         "desc(keywords)"
       ]
     }'
Enter fullscreen mode Exit fullscreen mode
  1. Keep content rich but concise Just like with traditional SEO, stuffing irrelevant keywords can hurt the experience. Focus on useful terms that real users are likely to type in your search bar.

In short, adding SEO-like fields inside your Meilisearch documents makes it easier for users to discover the right content quickly. You are not optimizing for Google, but for your own in-app search quality.

Where to Use It

Meilisearch fits well in many scenarios:

  • Search inside a documentation site
  • Product catalog search for e-commerce
  • Filtering content in dashboards
  • Building autocomplete or typeahead search bars

If you are looking for a solution that balances speed, simplicity, and flexibility, Meilisearch is worth trying.

Final Thoughts

Search is often overlooked until users start asking for it. With Meilisearch, you can provide a modern search experience without a steep learning curve. It is open source, fast, and easy to integrate, making it a solid choice for developers who want to add search without wrestling with heavy infrastructure.

If you're a software developer who enjoys exploring different technologies and techniques like this one, check out LiveReview.

LiveReview delivers high-quality feedback on your PRs/MRs within minutes.
It saves hours per review by providing fast, automated first-pass insights. This helps both junior and senior engineers move faster.

If you're tired of waiting on peer reviews or unsure about the quality of feedback you'll receive, LiveReview is here to help.

Comments 0 total

    Add comment