How to Self-Host ManticoreSearch with Docker

What Is ManticoreSearch?

ManticoreSearch is a high-performance search engine forked from Sphinx Search. It provides full-text search with a MySQL-compatible SQL interface — you can query it with standard SQL clients. Written in C++, it’s lightweight and fast, with native support for real-time indexing, JSON attributes, and Kibana-style dashboards via Manticore Buddy.

Prerequisites

  • A Linux server (Ubuntu 22.04+ recommended)
  • Docker and Docker Compose installed (guide)
  • 1 GB+ RAM
  • 5 GB+ free disk space

Docker Compose Configuration

Create a docker-compose.yml file:

services:
  manticoresearch:
    image: manticoresearch/manticore:17.5.1
    container_name: manticoresearch
    ports:
      - "9306:9306"    # MySQL protocol
      - "9308:9308"    # HTTP JSON API
    volumes:
      - manticore_data:/var/lib/manticore
    ulimits:
      nproc: 65535
      nofile:
        soft: 65535
        hard: 65535
      memlock:
        soft: -1
        hard: -1
    restart: unless-stopped

volumes:
  manticore_data:

Start the stack:

docker compose up -d

Initial Setup

SQL Interface

Connect with any MySQL client:

mysql -h 127.0.0.1 -P 9306

Create a table and insert documents:

CREATE TABLE movies (title text, genre string, year int);
INSERT INTO movies (title, genre, year) VALUES ('The Matrix', 'sci-fi', 1999);
INSERT INTO movies (title, genre, year) VALUES ('Interstellar', 'sci-fi', 2014);
INSERT INTO movies (title, genre, year) VALUES ('The Dark Knight', 'action', 2008);

Search:

SELECT * FROM movies WHERE MATCH('matrix');

HTTP API

# Insert via HTTP
curl -X POST http://localhost:9308/insert \
  -H "Content-Type: application/json" \
  -d '{"index": "movies", "doc": {"title": "Inception", "genre": "sci-fi", "year": 2010}}'

# Search via HTTP
curl -X POST http://localhost:9308/search \
  -H "Content-Type: application/json" \
  -d '{"index": "movies", "query": {"match": {"title": "inception"}}}'

Configuration

Ports

PortProtocolDescription
9306MySQLSQL queries via MySQL protocol
9308HTTPREST API and JSON queries
9312SphinxAPILegacy Sphinx protocol

Key Configuration

ManticoreSearch is configured via manticore.conf or through the SQL interface:

-- Set server-wide options
SET GLOBAL query_log_format = 'sphinxql';
SET GLOBAL thread_stack = '1m';

Advanced Configuration

Real-Time Indexes

ManticoreSearch supports real-time indexing (no need to rebuild indexes):

CREATE TABLE products (
    title text,
    description text,
    price float,
    category string attribute
) morphology='stem_en';

Auto-Suggest / Autocomplete

Built-in autocomplete support:

curl -X POST http://localhost:9308/autocomplete \
  -H "Content-Type: application/json" \
  -d '{"table": "movies", "query": "mat"}'

Replication

ManticoreSearch supports Galera-based replication for high availability (available in the official image).

Reverse Proxy

Configure your reverse proxy to forward to port 9308 (HTTP API). The MySQL port (9306) is typically not exposed publicly. See Reverse Proxy Setup.

Backup

docker run --rm -v manticore_data:/data -v $(pwd):/backup alpine \
  tar czf /backup/manticore-backup.tar.gz /data

ManticoreSearch also supports BACKUP SQL command for consistent snapshots. See Backup Strategy.

Troubleshooting

MySQL Client Can’t Connect

Symptom: Connection refused on port 9306. Fix: Verify the port mapping in docker-compose.yml. ManticoreSearch listens on 9306 for MySQL protocol, not 3306.

Symptom: Searches take longer than expected. Fix: Ensure proper indexes are defined on text fields. Use EXPLAIN to analyze queries. Consider enabling morphology (stem_en) for better relevance.

Data Not Persisting

Symptom: Data lost after container restart. Fix: Verify the volume mount for /var/lib/manticore. Ensure the volume is a named volume or bind mount, not an anonymous volume.

Resource Requirements

  • RAM: 200 MB - 2 GB depending on index size
  • CPU: Low-medium
  • Disk: Index size is typically 30-50% of raw data size

Verdict

ManticoreSearch is an underrated search engine that combines Elasticsearch-like capabilities with MySQL-protocol compatibility. If your team already knows SQL, ManticoreSearch removes the learning curve of a custom query DSL. It’s significantly lighter than Elasticsearch while still being fast and feature-rich.

Choose ManticoreSearch if you want SQL-based search or a lightweight Elasticsearch alternative. Choose Meilisearch for simpler application search. Choose Elasticsearch for the full ELK ecosystem.

FAQ

How does ManticoreSearch compare to Elasticsearch?

ManticoreSearch is significantly lighter (200 MB RAM vs 8+ GB) and uses standard SQL syntax instead of Elasticsearch’s Query DSL. Elasticsearch has a larger ecosystem (ELK stack, Kibana) and handles massive-scale data better. Choose ManticoreSearch for lightweight, SQL-friendly search. Choose Elasticsearch for the full ELK stack or when you need Kibana dashboards.

Can I use ManticoreSearch as a MySQL replacement?

Not exactly. ManticoreSearch speaks MySQL protocol so you can query it with MySQL clients, but it’s a search engine, not a relational database. It excels at full-text search, ranking, and filtering — not transactions, joins, or referential integrity. Use it alongside your primary database to offload search queries.

Does ManticoreSearch support fuzzy search and typo tolerance?

Yes. Configure morphology processors (stem_en, lemmatize_en) on your tables for stemming. Use the CALL SUGGEST function for “did you mean” suggestions. ManticoreSearch also supports regular expressions and proximity search for flexible matching.

Can I index data from PostgreSQL or MySQL automatically?

Yes. ManticoreSearch supports scheduled data source syncing. Define a source that pulls from your database, and ManticoreSearch periodically re-indexes the data. For real-time updates, use the real-time table type and insert/update via the SQL or HTTP API from your application.

How does ManticoreSearch compare to Meilisearch?

Meilisearch is designed for instant, typo-tolerant application search with minimal configuration — drop in documents, get search results immediately. ManticoreSearch is more powerful (SQL interface, Galera replication, advanced query features) but requires more configuration. Choose Meilisearch for simple app search; choose ManticoreSearch for complex search requirements.

Is there a web dashboard for ManticoreSearch?

ManticoreSearch includes Manticore Buddy, which provides a Kibana-style interface for exploring data and running queries. Access it via the HTTP API endpoint. For production monitoring, integrate with Grafana using ManticoreSearch’s metrics endpoints.

Comments