# Quick start

This quick start will walk you through setting up Meilisearch, adding documents, performing your first search, using the search preview, adding a search bar, and securing your instance.

All that is required is a command line (opens new window) for installation, and some way to interact with Meilisearch afterwards (e.g., cURL (opens new window) or one of our SDKs).

Let's get started!

# Setup and installation

We'll start with downloading and installing Meilisearch. You have the option to install Meilisearch locally or deploy it over a cloud service.

# Local installation

# Cloud deploy

To deploy Meilisearch on a cloud service, follow one of our dedicated guides:

# Running Meilisearch

On successfully running Meilisearch, you should see the following response:

888b     d888          d8b 888 d8b                                            888
8888b   d8888          Y8P 888 Y8P                                            888
88888b.d88888              888                                                888
888Y88888P888  .d88b.  888 888 888 .d8888b   .d88b.   8888b.  888d888 .d8888b 88888b.
888 Y888P 888 d8P  Y8b 888 888 888 88K      d8P  Y8b     "88b 888P"  d88P"    888 "88b
888  Y8P  888 88888888 888 888 888 "Y8888b. 88888888 .d888888 888    888      888  888
888   "   888 Y8b.     888 888 888      X88 Y8b.     888  888 888    Y88b.    888  888
888       888  "Y8888  888 888 888  88888P'  "Y8888  "Y888888 888     "Y8888P 888  888

Database path:       "./data.ms"
Server listening on: ""

Congratulations! You're ready to move on to the next step!

# Add documents

For this quick start, we will be using a collection of movies as our dataset. To follow along, first click this link to download the file: movies.json. Then, move the downloaded file into your working directory.


Meilisearch currently only accepts data in JSON, NDJSON, and CSV formats. You can read more about this in our documents guide.

Open a new terminal window and run the following command:

curl \
  -X POST 'http://localhost:7700/indexes/movies/documents' \
  -H 'Content-Type: application/json' \
  --data-binary @movies.json

Meilisearch stores data in the form of discrete records, called documents. Documents are grouped into collections, called indexes.


Currently, Meilisearch only supports JSON, CSV, and NDJSON formats.

The previous command added documents from movies.json to a new index called movies. After adding documents, you should receive a response like this:

    "uid": 0,
    "indexUid": "movies",
    "status": "enqueued",
    "type": "documentAddition",
    "enqueuedAt": "2021-08-11T09:25:53.000000Z"

Most database operations in Meilisearch are asynchronous. This means that rather than being processed instantly, API requests are added to a queue and processed one at a time.

Use the returned uid to check the status of your documents:

curl \
  -X GET 'http://localhost:7700/indexes/movies/tasks/0'

If the document addition is successful, the response should look like this:

   "uid": 0,
   "indexUid": "movies",
   "status": "succeeded",
   "type": "documentAddition",
      "receivedDocuments": 19547,
      "indexedDocuments": 19547
   "duration": "PT0.030750S",
   "enqueuedAt": "2021-12-20T12:39:18.349288Z",
   "startedAt": "2021-12-20T12:39:18.352490Z",
   "finishedAt": "2021-12-20T12:39:18.380038Z"

If the status field has the value enqueued or processing, all you have to do is wait a short time and check again. Proceed to the next step once the task status has changed to succeeded.

Now that you have Meilisearch set up, you can start searching!

curl \
  -X POST 'http://localhost:7700/indexes/movies/search' \
  -H 'Content-Type: application/json' \
  --data-binary '{ "q": "botman" }'

In the above code sample, the parameter q represents the search query. The documents you added in the previous step will be searched for text that matches botman.

Meilisearch response:

  "hits": [
      "id": 29751,
      "title": "Batman Unmasked: The Psychology of the Dark Knight",
      "poster": "https://image.tmdb.org/t/p/w1280/jjHu128XLARc2k4cJrblAvZe0HE.jpg",
      "overview": "Delve into the world of Batman and the vigilante justice tha",
      "release_date": "2008-07-15"
      "id": 471474,
      "title": "Batman: Gotham by Gaslight",
      "poster": "https://image.tmdb.org/t/p/w1280/7souLi5zqQCnpZVghaXv0Wowi0y.jpg",
      "overview": "ve Victorian Age Gotham City, Batman begins his war on crime",
      "release_date": "2018-01-12"
  "nbHits": 66,
  "exhaustiveNbHits": false,
  "query": "botman",
  "limit": 20,
  "offset": 0,
  "processingTimeMs": 12

By default, Meilisearch only returns the first 20 results for a search query. This can be changed using the limit parameter.

# Search preview

Meilisearch offers a search preview where you can preview search results. It comes with a search bar that allows you to search a selected index. You can access it in your browser at any time Meilisearch is running.

Meilisearch's search preview showing the movies index

If you have multiple indexes, you can switch between them using the indexes dropdown.

Meilisearch's search preview indicating the indexes dropdown in the upper right corner

# Front-end integration

The only step missing now is adding a search bar to your project. The easiest way of achieving this is to use instant-meilisearch (opens new window): a developer tool that generates all the components needed to start searching.

# Let's try it!

  1. Create an empty file and name it index.html
  2. Open it in a text editor like Notepad, Sublime Text, or Visual Studio Code
  3. Copy-paste one of the code samples above—either vanilla JavaScript, Vue 2, or React— and save the file
  4. Open index.html in your browser by double-clicking it in your folder

You should now have a working front-end search interface 🚀🔥

# Securing Meilisearch

The Meilisearch API is unprotected by default, making all routes publicly accessible. You can set a master key to protect your instance from unauthorized use:

When you launch your Meilisearch instance with a master key, two things happen:

Here's how to use the master key you set to get all keys:

curl \
  -X GET 'http://localhost:7700/keys' \
  -H 'Authorization: Bearer MASTER_KEY'

The master key should only be used for retrieving and managing API keys. For regular API calls, such as search, use an API key:

curl \ 
  -X POST 'http://localhost:7700/indexes/movies/search' \
  -H 'Authorization: Bearer API_KEY'    

To learn more about key management, refer to our dedicated guide.

# What's next?

You now know all the basics: how to install Meilisearch, create an index, add documents, check the status of an asynchronous task, and perform a search.

To keep going, continue to the Meilisearch 101 for a guided overview of the main features, or check out the API references to dive right in!