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:- Export your data from Elasticsearch
- Prepare your data for Meilisearch
- Import your data into Meilisearch
- Configure your Meilisearch index settings (optional)
This guide includes examples in JavaScript, Python, and Ruby. The packages used:
- JavaScript:
@elastic/elasticsearch8.x,meilisearch(compatible with Meilisearch v1.0+) - Python:
elasticsearch8.x,meilisearch - Ruby:
elasticsearch8.x,meilisearch
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: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 withsearch_after to paginate through all documents in the index. This approach is recommended over the deprecated Scroll API.
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 usegeo_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.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 methodaddDocumentsInBatches to upload all records in batches of 100,000.
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
| Elasticsearch | Meilisearch | Notes |
|---|---|---|
mappings.properties (field types) | Automatic | Meilisearch infers field types automatically |
properties.*.type: "text" | searchableAttributes | All fields are searchable by default; use this setting to restrict or reorder |
properties.*.type: "keyword" | filterableAttributes | Add fields you want to filter or facet on |
properties.*.index: false | displayedAttributes | Control which fields appear in results |
properties.*.type: "geo_point" | _geo field with lat/lng | Add _geo to filterableAttributes and sortableAttributes |
properties.*.type: "nested" | Flatten to top-level fields | Meilisearch does not support nested object queries |
_source.excludes | displayedAttributes | Only list the fields you want returned |
enabled: false | Omit from searchableAttributes | Fields are still stored but not searched |
Analysis and text processing
| Elasticsearch | Meilisearch | Notes |
|---|---|---|
analysis.analyzer | Automatic | Meilisearch uses a built-in language-aware analyzer |
analysis.tokenizer | separatorTokens / nonSeparatorTokens | Customize word boundary behavior |
analysis.filter.stop | stopWords | Define words to ignore during search |
analysis.filter.synonym | synonyms | Define equivalent terms |
analysis.filter.stemmer | Automatic | Built-in stemming via language detection |
settings.index.analysis.normalizer | Automatic | Meilisearch normalizes Unicode, casing, and diacritics automatically |
| Language-specific analyzers | localizedAttributes | Assign languages to specific fields |
Search query parameters
| Elasticsearch | Meilisearch | Notes |
|---|---|---|
query.match / query.multi_match | q search param | Meilisearch searches all searchableAttributes by default |
query.term / query.terms | filter search param | Use filter expressions for exact matches |
query.bool.filter | filter search param | Supports AND, OR, NOT, () operators |
query.bool.must / should / must_not | filter + q | Combine search query with filter expressions |
query.range | filter search param | Use operators like field > value or field value1 TO value2 |
query.fuzzy / fuzziness | Automatic | Built-in typo tolerance, configurable per index |
query.prefix | Automatic | Built-in prefix search on the last query word |
query.knn | hybrid + vector search params | Requires embedders setting |
query.geo_distance | _geoRadius(lat, lng, radius) in filter | Requires _geo in filterableAttributes |
query.geo_bounding_box | _geoBoundingBox([lat, lng], [lat, lng]) in filter | Requires _geo in filterableAttributes |
highlight | attributesToHighlight + highlightPreTag + highlightPostTag | Search params |
_source | attributesToRetrieve | Search param |
from / size | offset / limit or page / hitsPerPage | Search params |
sort | sort search param | Requires sortableAttributes setting |
search_after | offset / limit or page / hitsPerPage | Meilisearch uses simpler pagination |
aggs (aggregations) | facets search param | Returns value counts; complex aggregations are not supported |
explain | showRankingScore / showRankingScoreDetails | Search params |
collapse | distinct search param or distinctAttribute setting | Field-level deduplication |
min_score | rankingScoreThreshold | Search param |
Index settings
| Elasticsearch | Meilisearch | Notes |
|---|---|---|
index.number_of_replicas | Automatic (Meilisearch Cloud) | Meilisearch Cloud handles replication |
index.number_of_shards | Automatic (Meilisearch Cloud) | Meilisearch Cloud handles sharding |
index.max_result_window | pagination.maxTotalHits | Default is 1000 in Meilisearch |
index.refresh_interval | Automatic | Meilisearch indexes asynchronously via tasks |
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
boolqueries with nestedmust,should, andfilterclauses translate to a simpleqparameter combined with afilterstring.
Query comparison
This section shows how common Elasticsearch queries translate to Meilisearch.Full-text search
Elasticsearch:searchableAttributes by default. To restrict to a specific field, use the attributesToSearchOn search parameter.
Filtering
Elasticsearch:Attributes used in
filter must first be added to filterableAttributes.Sorting
Elasticsearch:Attributes used in
sort must first be added to sortableAttributes.Faceted search
Elasticsearch:filter to narrow results by range.
Geo search
Elasticsearch:The
_geo attribute must be added to both filterableAttributes and sortableAttributes.API methods
This section compares Elasticsearch and Meilisearch API operations.| Operation | Elasticsearch | Meilisearch |
|---|---|---|
| Create index | PUT /my-index | POST /indexes |
| Delete index | DELETE /my-index | DELETE /indexes/{index_uid} |
| Get index info | GET /my-index | GET /indexes/{index_uid} |
| List indexes | GET /_cat/indices | GET /indexes |
| Index document | POST /my-index/_doc | POST /indexes/{index_uid}/documents |
| Bulk index | POST /_bulk | POST /indexes/{index_uid}/documents (accepts arrays) |
| Get document | GET /my-index/_doc/{id} | GET /indexes/{index_uid}/documents/{id} |
| Delete document | DELETE /my-index/_doc/{id} | DELETE /indexes/{index_uid}/documents/{id} |
| Delete by query | POST /my-index/_delete_by_query | POST /indexes/{index_uid}/documents/delete |
| Search | POST /my-index/_search | POST /indexes/{index_uid}/search |
| Multi-search | POST /_msearch | POST /multi-search |
| Get settings | GET /my-index/_settings | GET /indexes/{index_uid}/settings |
| Update settings | PUT /my-index/_settings | PATCH /indexes/{index_uid}/settings |
| Create API key | POST /_security/api_key | POST /keys |
| Get cluster health | GET /_cluster/health | GET /health |
| Get task status | GET /_tasks/{task_id} | GET /tasks/{task_uid} |