Skip to main content
This page aims to help current users of Elasticsearch make the transition to Meilisearch. For a high-level comparison of the two search engines, see Meilisearch vs Elasticsearch.

Overview

This guide walks you through exporting documents from an Elasticsearch index and importing them into Meilisearch using a script in JavaScript, Python, or Ruby. You can also skip directly to the finished script. The migration process consists of four steps:
  1. Export your data from Elasticsearch
  2. Prepare your data for Meilisearch
  3. Import your data into Meilisearch
  4. Configure your Meilisearch index settings (optional)
To help with the transition, this guide also includes a comparison of settings and parameters, query types, and API methods. 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 Elasticsearch data

Initialize project

Install dependencies

Create Elasticsearch client

You need your Elasticsearch host URL and authentication credentials. Paste the below code in your script:
Replace ELASTICSEARCH_URL with your Elasticsearch cluster URL (for example, https://localhost:9200) and provide your authentication credentials.

Fetch data from Elasticsearch

Use the Point in Time API with search_after to paginate through all documents in the index. This approach is recommended over the deprecated Scroll API.
Replace YOUR_INDEX_NAME with the name of the Elasticsearch index you want to migrate.

Prepare your data

Elasticsearch documents are wrapped in metadata (_id, _index, _source). You need to extract the document data from _source and ensure each document has a valid primary key for Meilisearch.
Meilisearch stores documents as flat JSON objects. If your Elasticsearch documents use nested objects or the nested mapping type, you must flatten them before indexing. For example, { "author": { "name": "John" } } should become { "author_name": "John" } or kept as-is if you only need it for display purposes. Only top-level fields can be used for filtering, sorting, and searching.

Handle geo data

If your Elasticsearch documents use geo_point fields, convert them to Meilisearch’s _geo format:

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.
Replace MEILI_HOST, MEILI_API_KEY, and MEILI_INDEX_NAME with your Meilisearch host URL, API key, and target index name. Meilisearch will create the index if it doesn’t already exist.

Upload data to Meilisearch

Use the Meilisearch client method addDocumentsInBatches to upload all records in batches of 100,000.
When you’re ready, run the script:

Finished script

Configure your index settings

Meilisearch’s default settings deliver relevant, typo-tolerant search out of the box. However, if your Elasticsearch index relies on specific mappings or analyzers, you may want to configure equivalent Meilisearch settings. To customize your index settings, see configuring index settings. To understand the differences between Elasticsearch and Meilisearch settings, read on.

Key conceptual differences

Elasticsearch uses explicit mappings to define how each field is indexed, analyzed, and stored. You must configure analyzers, tokenizers, and field types before indexing data. Search behavior is controlled through a complex Query DSL. Meilisearch takes a different approach: all fields are automatically indexed and searchable by default. You refine behavior through index settings (which affect all searches) and search parameters (which affect a single query). Features like typo tolerance, prefix search, and ranking work out of the box without configuration. This means many Elasticsearch configurations have no direct equivalent in Meilisearch because the behavior is automatic. For example, you don’t need to configure analyzers for typo tolerance, prefix matching, or stop words: Meilisearch handles these by default.

Settings and parameters comparison

The below tables compare Elasticsearch mappings, settings, and query parameters with the equivalent Meilisearch features.

Index mappings and field configuration

Analysis and text processing

Search query parameters

Index settings

What you can simplify

Many Elasticsearch configurations become unnecessary when migrating to Meilisearch:
  • Analyzers and tokenizers: Meilisearch’s built-in text processing handles tokenization, normalization, stemming, and language detection automatically.
  • Mapping definitions: Field types are inferred. You don’t need to define mappings before indexing documents.
  • Replicas and shards: Meilisearch Cloud manages these automatically. Self-hosted instances run as a single process.
  • Index lifecycle management: Meilisearch doesn’t require index rotation, rollover policies, or shard management.
  • Query complexity: Most Elasticsearch bool queries with nested must, should, and filter clauses translate to a simple q parameter combined with a filter string.

Query comparison

This section shows how common Elasticsearch queries translate to Meilisearch. Elasticsearch:
Meilisearch:
Meilisearch searches all searchableAttributes by default. To restrict to a specific field, use the attributesToSearchOn search parameter.

Filtering

Elasticsearch:
Meilisearch:
Attributes used in filter must first be added to filterableAttributes.

Sorting

Elasticsearch:
Meilisearch:
Attributes used in sort must first be added to sortableAttributes.
Elasticsearch:
Meilisearch:
Meilisearch returns value distributions for each facet. Range aggregations are not supported: use filter to narrow results by range. Elasticsearch:
Meilisearch:
The _geo attribute must be added to both filterableAttributes and sortableAttributes.

API methods

This section compares Elasticsearch and Meilisearch API operations.

Front-end components

Elasticsearch offers Search UI, a React component library for building search interfaces. Meilisearch is compatible with Algolia’s InstantSearch libraries through Instant Meilisearch. InstantSearch provides a rich set of pre-built widgets for search boxes, hits, facets, pagination, and more. You can find an up-to-date list of the components supported by Instant Meilisearch in the GitHub project’s README.