Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

rotaercz's avatar

What are your thoughts on Meilisearch and Typesense?

I'm trying to figure out which one to use via Laravel Scout. Which one is faster? What do you guys recommend?

Edit: What queue driver should I use as well? Redis?

0 likes
6 replies
LaryAI's avatar
Level 58

Meilisearch and Typesense are both modern, fast, open-source search engines that can be integrated with Laravel Scout to provide powerful full-text search capabilities for your Laravel applications. Here's a brief comparison to help you decide which one might be better suited for your needs:

Meilisearch:

  • Meilisearch is known for its simplicity and ease of use. It's designed to provide a great out-of-the-box search experience with minimal configuration.
  • It has a typo-tolerant search algorithm, which is great for user-facing search where users might make spelling mistakes.
  • Meilisearch is written in Rust, which is known for its performance and safety.
  • It provides an official Laravel Scout integration, making it easy to set up with a Laravel application.

Typesense:

  • Typesense is also designed to be easy to use and focuses on speed and typo tolerance.
  • It is known for its high performance, especially on large datasets, due to its low-latency search.
  • Typesense is also written in C++ and is optimized for performance.
  • There is a community-driven Laravel Scout Typesense Engine that you can use to integrate Typesense with Laravel Scout.

Performance:

  • Both Meilisearch and Typesense are fast and can handle a significant amount of queries per second. The actual speed can depend on various factors such as the size of your dataset, the complexity of your search queries, and the resources available to the search engine.
  • It's recommended to benchmark both search engines with your own dataset and queries to see which one performs better for your specific use case.

Recommendation:

  • If you value simplicity and ease of use, and your dataset is not extremely large, Meilisearch might be the way to go.
  • If you are dealing with a very large dataset and need the absolute fastest search responses, Typesense might be more suitable.

Ultimately, both search engines are excellent choices and can be integrated with Laravel Scout. You should consider your project's specific requirements and possibly test both to see which one aligns better with your needs.

Here's a basic example of how you might set up Meilisearch with Laravel Scout:

// Install Laravel Scout and Meilisearch PHP Client
composer require laravel/scout meilisearch/meilisearch-php

// Publish the Scout configuration
php artisan vendor:publish --provider="Laravel\Scout\ScoutServiceProvider"

// In your .env file, set the following:
SCOUT_DRIVER=meilisearch
MEILISEARCH_HOST=http://127.0.0.1:7700
MEILISEARCH_KEY=masterKey

// In your model, use the Searchable trait
use Laravel\Scout\Searchable;

class Post extends Model
{
    use Searchable;

    // ...
}

And for Typesense, you would use the community-driven Laravel Scout Typesense Engine:

// Install Laravel Scout and Typesense Laravel Scout Engine
composer require laravel/scout typesense/laravel-scout

// Publish the Scout configuration
php artisan vendor:publish --provider="Laravel\Scout\ScoutServiceProvider"

// In your .env file, set the following:
SCOUT_DRIVER=typesense
TYPESENSE_HOST=http://127.0.0.1
TYPESENSE_PORT=8108
TYPESENSE_API_KEY=xyz

// In your model, use the Searchable trait
use Laravel\Scout\Searchable;

class Post extends Model
{
    use Searchable;

    // ...
}

Remember to replace the placeholders with your actual configuration details.

rotaercz's avatar

@LaryAI Based on your reply I'm siding towards Typesense because performance is the most important. Is there a recommended queue driver for Typesense?

nexxai's avatar

@rotaercz Neither Typesense nor Meilisearch are supported for queueing; that is not what their purpose is. They exist to make large amounts of (typically textual) data searchable and quickly. While you technically can use them as any old database, there are better, purpose-built DB systems like MySQL, PostgreSQL, and even Redis for those purposes.

For queueing, yes, the generally recommended system for Laravel Queues - if you plan on self-hosting it, and not using a system like AWS SQS - is Redis.

rotaercz's avatar

@nexxai Ah, interesting. The Laravel Scout documentation specifically recommends queues for Meilisearch and Typesense though?

nexxai's avatar

@rotaercz Yeah, they mean use a different queue driver (e.g. Redis) to push the records into whatever Scout-fronted system (Typesense, Meili, etc.) and update the indexes, so that it happens in a worker and doesn't interrupt your user's experience. They don't mean to use them as the queue driver.

kokoshneta's avatar

@rotaercz It doesn’t make any sense to use queues for search functionality. Queues offload time-intensive tasks to a stack that is then asynchronously handled after the server has sent a response back to the client. What happens to the queued elements is never again visible to the front-end user.

That doesn’t make sense for searching. If you queue searching, you end up with a search box in your app that does nothing, because the actual search happens on the server after it has sent its response to the user’s browser. The response to the browser will be empty, and later on the server will perform the search and do nothing with the results.

You can do queue-related things in your search endpoint, but that’s different. For example, you may want to log how many times and from where in the world a given search term is searched for, perhaps using an external API to extract and process stuff before you store it in your database. That would be time-intensive, so the controller method that handles the search would call Meilisearch/Typesense to retrieve the search results, offload all the logging stuff to a queue to be handled later, and then return the search results to the user.

And of course, as @nexxai says, this also goes for updating your search indexes. Every time you save a model in your app, Meilisearch/Typesense will be instructed by Scout to update its indexes for that model, and this may take a little while, so that action is offloaded to a queue to be handled after the server sends the “Model updated” response to you (or whatever it does on success).

Please or to participate in this conversation.