Getting Started

Meilisearch is a fast, typo-tolerant search engine designed for developers. It delivers sub-50ms search results with built-in ranking, filtering, and faceting. Available as an open web service in Eyevinn Open Source Cloud, Meilisearch is a great fit for adding search to any application without managing complex infrastructure.

Prerequisites

Step 1: Generate a master key

Meilisearch requires a master key (minimum 16 characters) that acts as the root authentication credential. Generate a strong random key, for example:

openssl rand -hex 32

Store this key somewhere safe, you will need it to authenticate all API requests.

Step 2: Store the master key as a secret

Navigate to the Meilisearch service page, go to the Service Secrets tab, and click New Secret. Enter a name such as masterkey and paste your generated key as the value.

Step 3: Create a Meilisearch instance

Go to the My meilisearchs tab and click Create meilisearch. Fill in:

  • Name: a unique name for your instance (alphanumeric only, e.g. mysearch)
  • MasterKey: {{secrets.masterkey}} (references the secret created in Step 2)

Click Create and wait for the status indicator to turn green.

Step 4: Verify and index data

Once the instance is running, click the instance URL to open the Meilisearch Mini Dashboard in your browser. Authenticate with your master key.

Index a document collection using the REST API:

curl -X POST 'https://<your-meilisearch-url>/indexes/movies/documents' \
  -H 'Authorization: Bearer <your-master-key>' \
  -H 'Content-Type: application/json' \
  --data '[
    {"id": 1, "title": "Carol", "genre": "Drama"},
    {"id": 2, "title": "Wonder Woman", "genre": "Action"},
    {"id": 3, "title": "Inception", "genre": "Sci-Fi"}
  ]'

Run a search:

curl 'https://<your-meilisearch-url>/indexes/movies/search?q=wonder' \
  -H 'Authorization: Bearer <your-master-key>'

Usage example from JavaScript

import { MeiliSearch } from 'meilisearch';

const client = new MeiliSearch({
  host: 'https://<your-meilisearch-url>',
  apiKey: '<your-master-key>'
});

const index = client.index('movies');
const results = await index.search('wonder');
console.log(results.hits);

Creating scoped API keys

Use the master key to create scoped API keys for your applications with limited permissions:

curl -X POST 'https://<your-meilisearch-url>/keys' \
  -H 'Authorization: Bearer <your-master-key>' \
  -H 'Content-Type: application/json' \
  --data '{
    "actions": ["search"],
    "indexes": ["movies"],
    "expiresAt": null
  }'

CLI usage

osc create meilisearch-meilisearch mysearch \
  -o MasterKey="your-master-key-at-least-16-chars"

Resources