Home Explore Blog Models CI



nixpkgs

nixos/modules/services/search/meilisearch.md
630fcedb5de0f240cbc3405a1b5cf298858d8b790b2b49830000000300000831
# Meilisearch {#module-services-meilisearch}

Meilisearch is a lightweight, fast and powerful search engine. Think elastic search with a much smaller footprint.

## Quickstart {#module-services-meilisearch-quickstart}

the minimum to start meilisearch is

```nix
{ services.meilisearch.enable = true; }
```

this will start the http server included with meilisearch on port 7700.

test with `curl -X GET 'http://localhost:7700/health'`

## Usage {#module-services-meilisearch-usage}

you first need to add documents to an index before you can search for documents.

### Add a documents to the `movies` index {#module-services-meilisearch-quickstart-add}

`curl -X POST 'http://127.0.0.1:7700/indexes/movies/documents' --data '[{"id": "123", "title": "Superman"}, {"id": 234, "title": "Batman"}]'`

### Search documents in the `movies` index {#module-services-meilisearch-quickstart-search}

`curl 'http://127.0.0.1:7700/indexes/movies/search' --data '{ "q": "botman" }'` (note the typo is intentional and there to demonstrate the typo tolerant capabilities)

## Defaults {#module-services-meilisearch-defaults}

- The default nixos package doesn't come with the [dashboard](https://docs.meilisearch.com/learn/getting_started/quick_start.html#search), since the dashboard features makes some assets downloads at compile time.

- `no_analytics` is set to true by default.

- `http_addr` is derived from {option}`services.meilisearch.listenAddress` and {option}`services.meilisearch.listenPort`. The two sub-fields are separate because this makes it easier to consume in certain other modules.

- `db_path` is set to `/var/lib/meilisearch` by default. Upstream, the default value is equivalent to `/var/lib/meilisearch/data.ms`.

- `dump_dir` and `snapshot_dir` are set to `/var/lib/meilisearch/dumps` and `/var/lib/meilisearch/snapshots`, respectively. This is equivalent to the upstream defaults.

- All other options inherit their upstream defaults. In particular, the default configuration uses `env = "development"`, which doesn't require a master key, in which case all routes are unprotected.

Chunks
f3fd08e6 (1st chunk of `nixos/modules/services/search/meilisearch.md`)
Title: Meilisearch Service Configuration and Usage
Summary
This document introduces Meilisearch as a lightweight and fast search engine, similar to Elasticsearch but with a smaller footprint. It provides a quickstart guide for enabling Meilisearch in NixOS using `{ services.meilisearch.enable = true; }`, which starts an HTTP server on port 7700. The usage section demonstrates how to add documents to an index (e.g., 'movies') and perform typo-tolerant searches using curl commands. It also outlines default configurations for the NixOS package, including the absence of the dashboard, `no_analytics` being true, default paths for database and dump/snapshot directories, and the `development` environment setting which leaves routes unprotected by default.