Master Fast Full‑Text Search with Meilisearch: A Hands‑On Docker Tutorial

Learn how to set up the lightweight Meilisearch engine using Docker, explore its rapid instant‑search features, and perform index, settings, document, and query operations via RESTful API and curl commands, all illustrated with step‑by‑step examples and screenshots.

Su San Talks Tech
Su San Talks Tech
Su San Talks Tech
Master Fast Full‑Text Search with Meilisearch: A Hands‑On Docker Tutorial

Introduction

Meilisearch is a lightweight search engine that supports a RESTful search API and has already earned over 50k+star on GitHub. Its goal is to provide a fast and accurate search experience for every user.

Fast search: results in under 50 ms

Instant search: results appear as you type

Smart typo‑tolerance

Comprehensive language support, especially Chinese

Highly customizable indexing and search behavior

RESTful API support

SDKs for Java, JavaScript, Go, Python, etc.

Installation

Deploy Meilisearch with Docker for quick setup.

docker pull getmeili/meilisearch:v1.13
docker run -p 7700:7700 --name meilisearch \
  -e MEILI_ENV='development' \
  -v /mydata/meiliData:/meili_data \
  -d getmeili/meilisearch:v1.13

After the container starts, access the Mini Dashboard at http://localhost:7700.

Meilisearch dashboard
Meilisearch dashboard

Usage

Index Operations

In Meilisearch, an index is a collection of documents, similar to a table in MySQL.

Download the official demo dataset from the Meilisearch documentation.

Demo data download
Demo data download

Upload the data to a server and import it with curl.

Data import
Data import

Import documents via curl:

curl \
  -X POST '{{MEILISEARCH_URL}}/indexes/movies/documents?primaryKey=id' \
  -H 'Content-Type: application/json' \
  --data-binary @movies.json

Search in the Mini Dashboard, e.g., type Transformers.

Search result
Search result

List all indexes:

curl \
  -X GET '{{MEILISEARCH_URL}}/indexes'

Delete an index:

curl \
  -X DELETE '{{MEILISEARCH_URL}}/indexes/movies'

Settings Operations

Settings are a JSON object that defines search behavior, similar to a table schema.

Query current settings:

curl \
  -X GET '{{MEILISEARCH_URL}}/indexes/movies/settings'

Modify settings to make title and release_date sortable, and genres and release_date filterable:

curl \
  -X PATCH '{{MEILISEARCH_URL}}/indexes/movies/settings' \
  -H 'Content-Type: application/json' \
  --data-binary '{
    "sortableAttributes": ["title", "release_date"],
    "filterableAttributes": ["genres", "release_date"]
  }'

Document Operations

Add a document:

curl \
  -X POST '{{MEILISEARCH_URL}}/indexes/movies/documents' \
  -H 'Content-Type: application/json' \
  --data-binary '{
    "id": 1,
    "title": "Transformers Test",
    "overview": "Young teenager, Sam Witwicky ...",
    "genres": ["Adventure", "Science Fiction", "Action"],
    "poster": "https://image.tmdb.org/t/p/w500/6eehp9I54syN3x753XMqjKz8M3F.jpg",
    "release_date": 1182902400
  }'

Retrieve a document:

curl \
  -X GET '{{MEILISEARCH_URL}}/indexes/movies/documents/1'

Update a document:

curl \
  -X PUT '{{MEILISEARCH_URL}}/indexes/movies/documents' \
  -H 'Content-Type: application/json' \
  --data-binary '[{"id": 1, "title": "Transformers Update"}]'

Delete a document:

curl \
  -X DELETE '{{MEILISEARCH_URL}}/indexes/movies/documents/1'

Search

Simple search for "Transformers":

curl \
  -X POST '{{MEILISEARCH_URL}}/indexes/movies/search' \
  -H 'Content-Type: application/json' \
  --data-binary '{ "q": "Transformers" }'

Paginated search (first 5 results):

curl \
  -X POST '{{MEILISEARCH_URL}}/indexes/movies/search' \
  -H 'Content-Type: application/json' \
  --data-binary '{ "q": "Transformers", "offset": 0, "limit": 5 }'

Sorted search by release date descending:

curl \
  -X POST '{{MEILISEARCH_URL}}/indexes/movies/search' \
  -H 'Content-Type: application/json' \
  --data-binary '{ "q": "Transformers", "offset": 0, "limit": 5, "sort": ["release_date:desc"]}'

Filtered search for Action or Adventure genres:

curl \
  -X POST '{{MEILISEARCH_URL}}/indexes/movies/search' \
  -H 'Content-Type: application/json' \
  --data-binary '{ "q": "Transformers", "offset": 0, "limit": 5, "sort": ["release_date:desc"], "filter": "genres = Action OR genres = Adventure"}'

Conclusion

Meilisearch delivers instant, low‑configuration full‑text search with speeds far exceeding many traditional solutions, making it a practical alternative to Elasticsearch for many projects.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Dockersearch enginecURLRESTful APIMeilisearch
Su San Talks Tech
Written by

Su San Talks Tech

Su San, former staff at several leading tech companies, is a top creator on Juejin and a premium creator on CSDN, and runs the free coding practice site www.susan.net.cn.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.