Configuring and Using the Meilisearch Search Engine in ServBay
Meilisearch is a robust, lightning-fast, and easy-to-use open-source search engine designed to deliver an outstanding “search-as-you-type” experience. It offers extensive features through a straightforward RESTful API. With ServBay, deploying a fully functional Meilisearch instance on a local macOS environment has never been easier.
Overview
ServBay integrates Meilisearch directly into its graphical management interface, allowing developers to install and configure it with a single click—no more hassles with complex command lines or dependencies. ServBay also automatically provides Meilisearch with a built-in web dashboard, accessible via the convenient domain https://meilisearch.servbay.host/
, where you can manage indexes, test searches, and monitor the service status.
Prerequisites
- ServBay is successfully installed and running on your macOS system.
- You have a development project ready for integrating search functionality.
- You have a basic understanding of search engine concepts such as Index, Document, and API Key.
Step-by-Step Guide
1. Install the Meilisearch Package
First, install Meilisearch via the ServBay package manager:
- Open the ServBay application.
- In the left navigation bar, click Packages.
- In the packages list, locate
Search
-Meilisearch
. - Click the install button next to
Meilisearch
and wait for the installation to finish. - Click the enable button to start the
Meilisearch
service.
2. Configure the Meilisearch Service
After installation, you can fine-tune the Meilisearch configuration:
In the left navigation panel of ServBay, click Search.
From the drop-down menu, select Meilisearch to enter its configuration screen.
Adjust the following settings as needed:
- Bind IP: The IP address Meilisearch listens to. The default
127.0.0.1
means the service is accessible only from your local machine—best practice for local development security. - Port: The underlying port for Meilisearch’s API, defaulting to
7700
. Although the service runs on this port, we strongly recommend that you interact with Meilisearch via the domain provided by ServBay:https://meilisearch.servbay.host
. - Master Key: This is the most critical credential protecting your Meilisearch instance. All API requests—including creating, updating, or deleting indexes—must be authorized with this key. Set a strong, unique password and keep it secure.
- Data Path: The local path where Meilisearch stores all index and database files. By default, it’s
/Applications/ServBay/data/meilisearch
. You can quickly open this directory in Finder by clicking the folder icon to the right. - Runtime Environment: Choose between
Development
andProduction
.Development
mode provides detailed error reports and API hints—ideal for development.Production
hides this information for better performance and security. - Log Level: Controls the detail of log output. Options include
INFO
,DEBUG
,WARN
,ERROR
, and more—helpful when debugging issues.
- Bind IP: The IP address Meilisearch listens to. The default
3. Save Configuration and Start the Service
- Once you’ve made your adjustments, click the Save button in the bottom right corner.
- ServBay will automatically apply your changes and attempt to start/restart the Meilisearch service.
- Check the status indicator next to Meilisearch; a green light means the service is running successfully.
4. Access the Meilisearch Web Dashboard
ServBay offers an extremely convenient way to access the built-in Meilisearch admin panel:
Method 1 (Recommended): In the top-right of the Meilisearch configuration page, click the browser icon (which looks like a compass). ServBay will open the dashboard in your default browser automatically.
Method 2: Manually enter
https://meilisearch.servbay.host/
into your browser’s address bar.
Within this dashboard, you can:
- Create and manage indexes.
- Easily test search queries and view results.
- Monitor task status (such as document additions or settings changes).
- Manage API keys.
5. Integrate Meilisearch into Your Application
You can connect to your local Meilisearch instance using any official or community-supported Meilisearch client library.
Use the following connection info:
- Host:
https://meilisearch.servbay.host
(make sure to includehttps://
) - API Key: The
Master Key
you set in Step 2.
Example: PHP Code (Using meilisearch/meilisearch-php
)
First, install the client library in your PHP project:
bash
composer require meilisearch/meilisearch-php
1
Then connect and operate with your code:
php
<?php
require_once 'vendor/autoload.php';
use MeiliSearch\Client;
// Initialize the Meilisearch client
$client = new Client('https://meilisearch.servbay.host', 'YOUR-STRONG-MASTER-KEY'); // Replace with your own Master Key
try {
// 1. Create or get an index
$index = $client->index('movies');
// 2. Add documents
$documents = [
['id' => 1, 'title' => 'Carol', 'genres' => ['Romance', 'Drama']],
['id' => 2, 'title' => 'Wonder Woman', 'genres' => ['Action', 'Adventure']],
['id' => 3, 'title' => 'Life of Pi', 'genres' => ['Adventure', 'Drama']],
['id' => 4, 'title' => 'Mad Max: Fury Road', 'genres' => ['Action', 'Adventure']],
['id' => 5, 'title' => 'Moana', 'genres' => ['Fantasy', 'Action']],
['id' => 6, 'title' => 'Philadelphia', 'genres' => ['Drama']],
];
$index->addDocuments($documents);
echo "Documents added to 'movies' index.\n";
// Wait a moment for Meilisearch to process the indexing task
sleep(1);
// 3. Perform a search
$searchResults = $index->search('max');
print_r($searchResults->getHits());
} catch (\Exception $e) {
echo "Meilisearch Error: {$e->getMessage()}\n";
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
Frequently Asked Questions (FAQ)
- Q: What should I do if I forget the Master Key?
- A: In the ServBay Meilisearch settings panel, you can simply enter a new Master Key and click Save. ServBay will restart the service for you and apply the new key.
- Q: What if the Meilisearch service fails to start?
- A: First, click the log icon at the top right of the Meilisearch settings page to view the live log. This typically contains clear error messages. Also, make sure that local port
7700
is not being used by another application.
- A: First, click the log icon at the top right of the Meilisearch settings page to view the live log. This typically contains clear error messages. Also, make sure that local port
- Q: What’s the practical difference between
Development
andProduction
under “Runtime Environment”?- A: In
Development
mode, API responses include detailed stack traces for errors, making debugging easier—but also exposing more internal details.Production
mode provides only general error info, which is safer and more performant—ideal for production environments or when you don’t need detailed debugging.
- A: In
Conclusion
The combination of ServBay and Meilisearch offers macOS developers a powerful, seamless local search development experience. With streamlined GUI management and a built-in web dashboard, you can stay focused on building your application's core search features without getting bogged down by tedious environment configurations.