Setup and installation
First, you need to download and install Meilisearch. This command installs the latest Meilisearch version in your local machine:Running Meilisearch
Next, launch Meilisearch by running the following command in your terminal:This tutorial uses
aSampleMasterKey as a master key, but you may change it to any alphanumeric string with 16 or more bytes. In most cases, one character corresponds to one byte.The above command uses the
--master-key configuration option to secure Meilisearch. Setting a master key is optional but strongly recommended in development environments. Master keys are mandatory in production environments.Add documents
In this quick start, you will search through a collection of movies. To follow along, first click this link to download the file: movies.json. Then, move the downloaded file into your working directory.Meilisearch accepts data in JSON, NDJSON, and CSV formats.
movies.json to a new index called movies. It also set id as the primary key.
Every index must have a primary key, an attribute shared across all documents in that index. If you try adding documents to an index and even a single one is missing the primary key, none of the documents will be stored.If you do not explicitly set the primary key, Meilisearch infers it from your dataset.
taskUid to check the status of your documents:
Most database operations in Meilisearch are asynchronous. Rather than being processed instantly, API requests are added to a queue and processed one at a time.
status is 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.
Search
Now that you have Meilisearch set up, you can start searching!This tutorial queries Meilisearch with the master key. In production environments, this is a security risk. Prefer using API keys to access Meilisearch’s API in any public-facing application.
q represents the search query. This query instructs Meilisearch to search for botman in the documents you added in the previous step:
limit parameter.