Self-hosting Meilisearch

Meilisearch is a fast, typo-tolerant search engine written in Rust, with a small API that front-end developers like. Its storage is memory-mapped, so it uses memory as cache rather than requiring the whole index in RAM.

What makes Meilisearch a good fit for site search?

Relevant results with almost no tuning. It handles typos, prefix search for search-as-you-type, filters, facets, sorting, synonyms, stop words and multiple languages out of the box, and offers hybrid search with embeddings. The community edition is MIT licensed. It is a single binary with a REST API on port 7700, so a working search for a shop, a documentation site or an app takes an afternoon.

How do I install and start it?

Download the release binary or use the official install script, create a service user and data folder, and start it in production mode with a master key of at least 16 bytes.

curl -L https://install.meilisearch.com | sh && mv ./meilisearch /usr/local/bin/
useradd -r -d /var/lib/meili -s /usr/sbin/nologin meili && install -d -o meili /var/lib/meili
sudo -u meili meilisearch --env production --master-key "$(cat /etc/meili.key)" --db-path /var/lib/meili/data --http-addr 127.0.0.1:7700

Put nginx with a certificate in front, and wrap the command in a systemd unit that reads the key from a file only root and the service user can read.

How do keys work?

The master key only creates and manages other keys. At first start Meilisearch creates a default search key and a default admin key. Give browsers a search-only key limited to the indexes they need; for per-user restrictions, generate tenant tokens signed with an API key that embed filter rules, so each user only sees their own documents. Keep admin keys on your servers.

Which index settings matter?

Tell Meilisearch which fields to search, filter and sort on, and in which order to rank. Defaults search every field, which is slower to index and less precise.

curl -X PATCH "http://127.0.0.1:7700/indexes/books/settings" -H "Authorization: Bearer $MEILI_ADMIN" -H "Content-Type: application/json" --data '{
  "searchableAttributes": ["title", "authors", "summary"],
  "filterableAttributes": ["language", "year", "format"],
  "sortableAttributes": ["year", "price"],
  "rankingRules": ["words", "typo", "proximity", "attribute", "sort", "exactness"]
}'

Changing these settings triggers a reindex, so set them before loading large data sets.

How does it use memory and disk?

Indexes are stored in LMDB files that are memory-mapped. The operating system keeps the busy parts in memory and reads the rest from disk on demand, so an index larger than memory still works, just slower for cold queries. For the best latency, keep memory at least as large as the index files of the indexes you search often. Index size on disk is often several times the raw JSON, because of the many inverted indexes that make search fast; NVMe drives keep cold reads quick.

How fast does indexing go?

Indexing is the heavy part and uses many cores. Documents are added in batches through an asynchronous task queue; check task status to know when they are searchable. Send large imports in batches of tens of megabytes, avoid changing settings in the middle, and give the machine enough cores that a full reindex finishes in minutes rather than hours. Embedding generation for hybrid search adds CPU time, or calls to an external embedding service if you configure one.

How do I back it up?

Two ways. Snapshots are exact copies of the database, fast to restore on the same version; schedule them with --schedule-snapshot. Dumps are portable exports used to move between versions, created with the dumps endpoint and imported at start with --import-dump. Copy both off the machine.

Which machine fits?

IndexMachineWhy
Up to 1 million documentsESSENTIAL-132 GB DDR4, NVMe
Several million with facetsESSENTIAL-SFast cores for indexing
Large catalogues, frequent reindexESSENTIAL-416 cores, 64 GB DDR4

ESSENTIAL-S at $46.20 a month indexes quickly on its Zen 5 cores and keeps a mid-sized index in memory. Compare with Typesense search servers, which holds indexes fully in RAM, and OpenSearch clusters for log analytics.

Machines for Meilisearch

Lowest monthly price of each model across its data centres; the model page shows the price in every location.

ModelProcessorCoresMemoryDrivesPortPer month
ESSENTIAL-1Intel Xeon-E 2386G632 GB2x 512 GB SSD NVMe1 Gbps unmetered$38.40
ESSENTIAL-2Intel Xeon-E 2388G832 GB2x 512 GB SSD NVMe1 Gbps unmetered$43.20
ESSENTIAL-SAMD Ryzen 7 9700X864 GB2x 512 GB SSD NVMe1 Gbps unmetered$46.20
ESSENTIAL-MAMD Ryzen 9 9900X1264 GB2x 512 GB SSD NVMe1 Gbps unmetered$70.80
ESSENTIAL-4AMD EPYC 73131664 GB2x 960 GB SSD NVMe1 Gbps unmetered$106.20
BUSINESS-2 2024AMD EPYC 4344P864 GB2x 960 GB SSD NVMe3 Gbps unmetered$109.80

Give indexing enough cores and keep hot indexes within memory.

See all servers and prices

Related pages

Typesense search servers

Host Typesense, the open-source typo-tolerant search engine: in-memory indexes, port 8108, scoped API keys, three-node Raft clusters and memory sizing.

Read more

OpenSearch clusters

Run OpenSearch for search and logs on bare metal: heap and mmap limits, security plugin setup, shard sizing, index state management and node roles.

Read more

E-commerce shops

Single machines and two node setups for WooCommerce, Magento, PrestaShop and headless shops that must stay fast at checkout.

Read more

Database servers

NVMe machines with large memory for PostgreSQL, MySQL, MariaDB and MongoDB, from a single primary to replicated pairs.

Read more

Questions and answers

Does Meilisearch keep the index in memory?

It memory-maps LMDB files, so the OS caches busy parts in RAM and reads the rest from disk; more memory means faster cold queries.

Which port does Meilisearch use?

Port 7700 by default. Bind it to localhost and put nginx with TLS in front for public traffic.

How do I give a website safe access to Meilisearch?

Use a search-only API key limited to specific indexes, or tenant tokens with embedded filters for per-user restrictions.

What is the difference between a Meilisearch snapshot and a dump?

A snapshot is an exact database copy for the same version; a dump is a portable export used to move between versions.

What licence does Meilisearch use?

The community edition is released under the MIT licence.