# Quick start

In this quick start we will walk you through setting up Meilisearch, adding documents, performing your first search, using the search preview, and adding a search bar.

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!

# Step 1: 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: "127.0.0.1:7700"

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

# Step 2: 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.

Open a new terminal window and run the following command:

curl \
  -X POST 'http://127.0.0.1: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.

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",
   "details":{
      "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://127.0.0.1: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 step two 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.

# Step 4: 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 http://127.0.0.1:7700 any time Meilisearch is running.

Screenshot of Meilisearch's search preview indicating the indexes dropdown on the upper right corner

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

# Step 5: 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 🚀🔥

# 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!