Skip to main content
This page aims to help current users of Algolia make the transition to Meilisearch. For a high-level comparison of the two search companies and their products, see our analysis of the search market.

Overview

This guide will take you step-by-step through the creation of a script to upload Algolia index data to Meilisearch. Examples are provided in JavaScript, Python, and Ruby. You can also skip directly to the finished script. The migration process consists of three steps:
  1. Export your data stored in Algolia
  2. Import your data into Meilisearch
  3. Configure your Meilisearch index settings (optional)
To help with the transition, we have also included a comparison of Meilisearch and Algolia’s API methods and front-end components. Before continuing, make sure you have Meilisearch installed and have access to a command-line terminal. If you’re unsure how to install Meilisearch, see our quick start.
This guide includes examples in JavaScript, Python, and Ruby. The packages used:

Export your Algolia data

Initialize project

mkdir algolia-meilisearch-migration
cd algolia-meilisearch-migration
npm init -y
touch script.js

Install dependencies

npm install -s algoliasearch@4 meilisearch

Create Algolia client

You’ll need your Application ID and Admin API Key to start the Algolia client. Both can be found in your Algolia account. Paste the below code in your script file:
const algoliaSearch = require("algoliasearch");

const algoliaClient = algoliaSearch(
  "APPLICATION_ID",
  "ADMIN_API_KEY"
);
const algoliaIndex = algoliaClient.initIndex("INDEX_NAME");
Replace APPLICATION_ID and ADMIN_API_KEY with your Algolia application ID and admin API key respectively. Replace INDEX_NAME with the name of the Algolia index you would like to migrate to Meilisearch.

Fetch data from Algolia

To fetch all Algolia index data at once, use Algolia’s browseObjects method.
let records = [];
await algoliaIndex.browseObjects({
    batch: (hits) => {
      records = records.concat(hits);
    }
  });
The records array will contain all documents from your Algolia index. We will use records again later in the upload process.

Import your data into Meilisearch

Create Meilisearch client

Create a Meilisearch client by passing the host URL and API key of your Meilisearch instance. The easiest option is to use the automatically generated admin API key.
const { MeiliSearch } = require("meilisearch");

const meiliClient = new MeiliSearch({
  host: "MEILI_HOST",
  apiKey: "MEILI_API_KEY",
});
const meiliIndex = meiliClient.index("MEILI_INDEX_NAME");
Replace MEILI_HOST,MEILI_API_KEY, and MEILI_INDEX_NAME with your Meilisearch host URL, Meilisearch API key, and the index name where you would like to add documents. Meilisearch will create the index if it doesn’t already exist.

Upload data to Meilisearch

Next, use addDocumentsInBatches to upload all your records in batches of 100,000.
const BATCH_SIZE = 100000;
await meiliIndex.addDocumentsInBatches(records, BATCH_SIZE);
That’s all! When you’re ready to run the script, enter the below command:
node script.js

Finished script

const algoliaSearch = require("algoliasearch");
const { MeiliSearch } = require("meilisearch");

const BATCH_SIZE = 100000;

(async () => {
  const algoliaClient = algoliaSearch("APPLICATION_ID", "ADMIN_API_KEY");
  const algoliaIndex = algoliaClient.initIndex("INDEX_NAME");

  let records = [];
  await algoliaIndex.browseObjects({
    batch: (hits) => {
      records = records.concat(hits);
    }
  });

  const meiliClient = new MeiliSearch({
    host: "MEILI_HOST",
    apiKey: "MEILI_API_KEY",
  });
  const meiliIndex = meiliClient.index("MEILI_INDEX_NAME");

  await meiliIndex.addDocumentsInBatches(records, BATCH_SIZE);
})();

Configure your index settings

Meilisearch’s default settings are designed to deliver a fast and relevant search experience that works for most use-cases. To customize your index settings, we recommend following this guide. To learn more about the differences between settings in Algolia and Meilisearch, read on.

Index settings vs. search parameters

One of the key usage differences between Algolia and Meilisearch is how they approach index settings and search parameters. In Algolia, API parameters is a flexible category that includes both index settings and search parameters. Many API parameters can be used both at indexing time—to set default behavior—or at search time—to override that behavior. In Meilisearch, index settings and search parameters are two distinct categories. Settings affect all searches on an index, while parameters affect the results of a single search. Some Meilisearch parameters require index settings to be configured beforehand. For example, you must first configure the index setting sortableAttributes to use the search parameter sort. However, unlike in Algolia, an index setting can never be used as a parameter and vice versa.

Settings and parameters comparison

The below table compares Algolia’s API parameters with the equivalent Meilisearch setting or search parameter. The Type column indicates whether the Meilisearch equivalent is a search parameter (param), an index setting (setting), or both.

Query and pagination

AlgoliaMeilisearchType
queryqparam
offsetoffsetparam
lengthlimitparam
pagepageparam
hitsPerPagehitsPerPageparam
paginatedHits limitpagination.maxTotalHitssetting

Filtering and sorting

AlgoliaMeilisearchType
filtersfilterparam
facetsfacetsparam
attributesForFacetingfilterableAttributessetting
maxValuesPerFacetfaceting.maxValuesPerFacetsetting
sortFacetValuesByfaceting.sortFacetValuesBysetting
maxFacetHitsfacetSearchsetting
Sorting (using replicas)sortableAttributes + sort param (no replicas required)setting + param
distinctdistinct (per-query) or distinctAttribute (index-wide)param + setting
attributeForDistinctdistinctAttributesetting
AlgoliaMeilisearchType
aroundLatLng / aroundRadius_geoRadius(lat, lng, radius) in filterparam
insideBoundingBox_geoBoundingBox([lat, lng], [lat, lng]) in filterparam
insidePolygon_geoPolygon([lat, lng], [lat, lng], ...) in filterparam
aroundPrecisionNo direct equivalent

Highlighting and snippets

AlgoliaMeilisearchType
attributesToHighlightattributesToHighlightparam
highlightPreTaghighlightPreTagparam
highlightPostTaghighlightPostTagparam
attributesToSnippetattributesToCrop + cropLengthparam
snippetEllipsisTextcropMarkerparam
restrictHighlightAndSnippetArraysNot supported

Attributes and ranking

AlgoliaMeilisearchType
searchableAttributessearchableAttributessetting
restrictSearchableAttributesattributesToSearchOnparam
attributesToRetrieveattributesToRetrieveparam
unretrievableAttributesNo direct equivalent; achieved by removing attributes from displayedAttributessetting
rankingrankingRulessetting
customRankingIntegrated within rankingRulessetting
getRankingInfoshowRankingScore / showRankingScoreDetailsparam

Typo tolerance and language

AlgoliaMeilisearchType
typoTolerancetypoTolerancesetting
disableTypoToleranceOnAttributestypoTolerance.disableOnAttributessetting
removeStopWordsstopWordssetting
synonymssynonymssetting
separatorsToIndexseparatorTokens / nonSeparatorTokenssetting
naturalLanguageslocalizedAttributes setting + locales paramsetting + param
queryType (prefix matching)prefixSearchsetting
removeWordsIfNoResultsAutomatically supported via matchingStrategy paramparam
AlgoliaMeilisearchType
NeuralSearch modehybrid param + embedders settingsetting + param
enableReRankingIntegrated in hybrid searchparam
AI personalizationpersonalizeparam

Other

AlgoliaMeilisearchType
analytics / clickAnalyticsSeparate Analytics API
disablePrefixOnAttributesNot supported
relevancyStrictnessrankingScoreThresholdparam

API methods

This section compares Algolia and Meilisearch’s respective API methods, using JavaScript for reference.
MethodAlgoliaMeilisearch
Index Instantiationclient.initIndex()
Here, client is an Algolia instance.
client.index()
Here, client is a Meilisearch instance.
Create IndexAlgolia automatically creates an index the first time you add a record or settings.The same applies to Meilisearch, but users can also create an index explicitly: client.createIndex(string indexName)
Get All Indexesclient.listIndices()client.getIndexes()
Get Single IndexNo method availableclient.getIndex(string indexName)
Delete Indexindex.delete()client.deleteIndex(string indexName)
Get Index Settingsindex.getSettings()index.getSettings()
Update Index Settingsindex.setSettings(object settings)index.updateSettings(object settings)
Search Methodindex.search(string query, { searchParameters, requestOptions })index.search(string query, object searchParameters)
Add Objectindex.saveObjects(array objects)index.addDocuments(array objects)
Partial Update Objectindex.partialUpdateObjects(array objects)index.updateDocuments(array objects)
Delete All Objectsindex.deleteObjects(array objectIDs)index.deleteAllDocuments()
Delete One Objectindex.deleteObject(string objectID)index.deleteDocument(string id)
Get All Objectsindex.getObjects(array objectIDs)index.getDocuments(object params)
Get Single Objectindex.getObject(str objectID)index.getDocument(string id)
Get API Keysclient.listApiKeys()client.getKeys()
Get API Key Infoclient.getApiKey(string apiKey)client.getKey(string apiKey)
Create API Keyclient.addApiKey(array acl)client.createKey(object configuration)
Update API Keyclient.updateApiKey(string apiKey, object configuration)client.updateKey(string apiKey, object configuration)
Delete API Keyclient.deleteApiKey(string apiKey)client.deleteKey(string apiKey)

Front-end components

InstantSearch is a collection of open-source tools maintained by Algolia and used to generate front-end search UI components. To use InstantSearch with Meilisearch, you must use Instant Meilisearch. Instant Meilisearch is a plugin connecting your Meilisearch instance with InstantSearch, giving you access to many of the same front-end components as Algolia users. You can find an up-to-date list of the components supported by Instant Meilisearch in the GitHub project’s README.