Medusa Search vs Meilisearch
This guide compares Medusa Search and Meilisearch to help you decide which one to use for your Medusa project.
What is Medusa Search?#
Medusa Search is a managed search service for Cloud projects. It stores your search indexes outside of your database and serves search queries for them, from full-text queries with relevance ranking to vector search over embeddings.
What is Meilisearch?#
Meilisearch is an open source search engine that provides full-text search, typo tolerance, and faceted search out of the box. You either run it yourself or subscribe to Meilisearch Cloud, then provision an index and manage its keys and settings for each environment.
Comparison Summary#
Concern | Medusa Search | Meilisearch |
|---|---|---|
Medusa provisions the service and passes the credentials to your application. | Run the engine yourself, or create a Meilisearch Cloud project. Either way, add the host and key to every environment. | |
The PostgreSQL provider indexes into your local database, so no service to run. | Run the same engine locally as a single binary or container. | |
None by default. Medusa provides Medusa Search and manages the infrastructure for you out of the box. | A Search Module Provider you build and maintain to connect your application to Meilisearch and manage the search indexes. | |
Medusa manages one set of indexes per environment for you. | You name and provision an index per environment, or run an instance per environment. | |
No separate subscription. Your plan includes a monthly allowance of search requests, and anything above it is Flex Usage. | Your own infrastructure and engineering time when you self-host, or a Meilisearch Cloud subscription. | |
Medusa provides the indexing logic and keeps the indexes current automatically. | You must implement and maintain the indexing logic in your Algolia Search Module Provider to work with the Search Module. | |
Both supported, and you opt into each one per query. | Supported and configurable per index. | |
Hybrid search that blends text and vector results by a semantic ratio, on the Scale and Enterprise plans, with embeddings Medusa Search can create for you on the Enterprise plan. | Hybrid text and vector search, and a configured embedder can compute the embeddings. | |
Any number of fields, but not alongside a vector query. | Any attribute in | |
Supported by Medusa's InstantSearch adapter. | Supported by Medusa's InstantSearch adapter. | |
Uses your indexes automatically. | Uses your indexes automatically. |
Setup and Infrastructure#
Medusa Search#
Medusa provisions Medusa Search for every Cloud environment. It passes the credentials to your Medusa application, which registers the provider for you. So, you don't need to manually configure or maintain the search infrastructure. You can immediately start searching.
Meilisearch#
Meilisearch takes considerably more work before you can run a single search:
- Run the engine yourself, or create a Meilisearch Cloud project. Self-hosting also puts the host, the backups, the monitoring, and every version upgrade on you.
- Provision an index for every environment, and pick a naming scheme that keeps them apart.
- Generate a write key and a search-only key, then store both as environment variables in every Cloud environment.
- Configure the index settings, including the order of
searchableAttributes, thefilterableAttributes, thesortableAttributes, typo tolerance, and the ranking rules. - Repeat steps 2 to 4 for every environment you add, and keep the settings identical across all of them.
Step 4 is the one that keeps costing you. Meilisearch stores the index settings on the instance rather than in your codebase, so they drift out of version control unless you push them from code as part of a deployment. A fresh instance with the defaults answers the same query with different relevance than your production one.
You then connect Meilisearch to Medusa, which requires creating a Search Module Provider as explained in the Integration with Medusa section.
Local Development#
Medusa Search runs on Cloud only. In local development, Medusa registers the PostgreSQL Search Module Provider instead, which indexes into your local database. You declare and test an index without running a search engine on your machine. You can also connect to your environment's search endpoint.
For MeiliSearch, you run the same engine locally that you run in production, so relevance behaves the same in both, and there's no second provider whose feature set you have to check against.
Integration with Medusa#
With Medusa Search#
Medusa provides Medusa Search out of the box. You don't need to spend time building, maintaining, or configuring it yourself. The infrastructure is ready for you to use immediately, allowing you to focus on defining your search indexes and integrating them into your application.
With Meilisearch#
Medusa doesn't maintain a Search Module Provider for Meilisearch, so you have to build a custom one. A Search Module Provider implements the interface the Search Module calls to interact with the search engine.
The provider needs to handle several responsibilities:
- Provide the connection layer to create, migrate, and delete a physical index from an index definition, including translating each field type and modifier into Meilisearch's index settings.
- Upsert and delete documents in batches, and delete by a filter.
- Compile the Search Module's filter tree, including
$or,$not, and several operators on one field, into a Meilisearch filter expression. - Compile facets, sorting, pagination, and search options into Meilisearch queries, and decide what to reject when the engine can't serve a request.
- Map Meilisearch's response back into the shape the module expects, including the relevance score and the facet results.
So, by integrating Meilisearch, you spend more time building and maintaining the search infrastructure yourself, compared to using Medusa Search, which is ready to use out of the box.
Refer to Search Module Providers for how the module loads and calls a provider, and to Create Search Module Provider for the interface to implement.
Environments and Previews#
Medusa Search#
Medusa gives each Cloud environment its own set of Medusa Search indexes, scoped by the environment's handle, so a preview environment never writes to production indexes. When you configure a base environment in the shared previews settings, Cloud copies the base environment's indexes into the new preview environment along with its database.
Meilisearch#
With Meilisearch, index isolation is your responsibility, and you choose between two approaches:
- One instance, an index prefix per environment. Cheaper, but every environment shares the instance's resources, and a bad write in a preview can reach a production index if the prefix is wrong.
- An instance per environment. Fully isolated, and each instance costs infrastructure or a Meilisearch Cloud project.
Either way, a preview environment starts with an empty index and needs a full sync before search works.
Cost and Packaging#
Option | What you pay for | What drives the cost up |
|---|---|---|
Medusa Search | No separate subscription, since Medusa Search is available on all Cloud plans. Each plan includes a monthly allowance of search requests. Refer to Plans & Pricing for the allowance your plan includes. | Search requests beyond your plan's allowance, which count as Flex Usage. |
Meilisearch, self-hosted | The infrastructure you run it on, plus the engineering time to operate it. The engine itself is open source. | Index size and traffic, since both drive the instance you need. Operational time doesn't scale down with the catalog. |
Meilisearch Cloud | A separate subscription, priced on the documents you store and the searches you run. | Catalog size, traffic, and a project per environment. |
Meilisearch also has some important considerations to keep in mind:
- The real cost of self-hosting. The engine is free, and the on-call rotation, the upgrade work, and the disk you size for the index are not.
- Document count, not product count. If you flatten variants or localized fields into separate documents, your document count grows much faster than your catalog does.
Other Cloud Usage MeiliSearch Affects#
Using Meilisearch for Search on Cloud can drive up the costs of the following Cloud usage metrics:
- Data Transfer covers external service communications, so every index write and every search your backend sends to Meilisearch counts toward it, along with the responses. This applies to a self-hosted instance and to Meilisearch Cloud alike, since both sit outside your Medusa server.
- Compute covers the indexing work, since the seed and the event handlers that write to Meilisearch run in your Medusa application.
Refer to Usage on how to monitor both metrics.
Indexing and Synchronization#
The Search Module orchestrates the flow for indexing and data synchronization. It uses the methods implemented in the configured provider to interact with the underlying search engine, whether it's Medusa Search or Meilisearch.
Medusa maintains Medusa Search, so it already implements all the necessary methods for indexing and synchronization.
For Meilisearch, it's your responsibility to provide an implementation that translates the Search Module's calls into Meilisearch API requests, allowing the Search Module to manage indexes and push documents into Meilisearch. You must maintain this implementation as Medusa updates the Search Module and its indexing logic.
Search Capabilities#
The Search Module provides the interface to perform search queries, but each Search Module Provider must translate those features into the specific capabilities and syntax of the underlying search engine.
Capability | Medusa Search | Meilisearch |
|---|---|---|
Full-text relevance | Relevance scales with the weight you set on each field. | A configurable ranking order, and the order of |
Typo tolerance | Supported and configurable per index and query, with word-length thresholds and field exemptions. | Supported, and you can tune or disable it per index and per attribute. |
Filters | Every operator the Search Module offers, including | A filter expression syntax, on attributes you add to |
Synonyms and stop words | Not supported. An index that declares them fails at startup. | Both supported as index settings. |
Facets | Value and range facets. The hits, the count, and every facet of a query run as one search request. | Facet distribution and facet search on filterable attributes. |
Highlighting and cropping | Supported on searchable fields, with your own markers and optional snippets. | Supported per query, with configurable markers. |
Sorting by an attribute | Any number of fields, but not alongside a vector query. | Any attribute in |
Vector and semantic search | Hybrid search that blends text and vector results by a semantic ratio, on the Scale and Enterprise plans. You compute the embeddings, or Medusa Search creates them for you on the Enterprise plan. | Hybrid search that blends text and vector results by a semantic ratio, with an embedder that can compute the embeddings. |
Geo search | Not supported. An index that declares a geo field fails at startup. | Supported, with geo filters and sorting by distance. |
Deep pagination | Up to the 10,000th result. | A configurable maximum number of total hits caps it. |
Multi-tenancy on one index | Filter per query in your API route. | Tenant tokens carry a filter that the engine enforces on every query the token makes. |
Storefront Integration#
InstantSearch is a family of open source UI libraries, which render a search interface from widgets such as a search box, a hit list, facet filters, and pagination. It's available for plain JavaScript, React, Vue, and Angular.
Medusa's InstantSearch adapter connects those widgets to Medusa's Search Module. It works with any Search Module Provider you integrate in your Medusa application, including both Medusa Search and your custom Meilisearch provider.
1import {2 createInstantSearchAdapter,3} from "@medusajs/instantsearch-adapter"4import { sdk } from "./sdk"5import {6 Configure,7 InstantSearch,8} from "react-instantsearch"9 10const PRODUCT_INDEX_NAME = "product"11 12export const { searchClient } = createInstantSearchAdapter({13 sdk,14 path: "/store/search",15})16 17const Search = () => (18 <InstantSearch19 indexName={PRODUCT_INDEX_NAME}20 searchClient={searchClient}21 >22 <Configure hitsPerPage={12} />23 {/* Render search widgets */}24 </InstantSearch>25)
Refer to the InstantSearch Adapter guide for more details and examples of setting up search and filters.
Admin Dashboard Search#
The Medusa Admin dashboard's global search calls the Admin Search API route, which uses the Search Module for every entity that has an index and falls back to database queries for the rest. Declaring an index for an entity therefore improves admin search with no extra work.
This is agnostic across different Search Module Providers, so it works the same for Medusa Search or your custom Meilisearch provider.
Comparisons to Other Search Engines#
The following guides compare Medusa Search to other search engines: