Skip to content

Commit 4dd3823

Browse files
add /export route
1 parent e624968 commit 4dd3823

4 files changed

Lines changed: 98 additions & 1 deletion

File tree

.code-samples.meilisearch.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1467,6 +1467,18 @@ related_results_similar_1: |-
14671467
"id": 192,
14681468
"embedder": "EMBEDDER_NAME"
14691469
}'
1470+
export_post_1: |-
1471+
curl \
1472+
-X POST 'MEILISEARCH_URL/export' \
1473+
-H 'Content-Type: application/json' \
1474+
--data-binary '{
1475+
"url": "TARGET_INSTANCE_URL",
1476+
"indexes": {
1477+
"*": {
1478+
"overrideSettings": true
1479+
}
1480+
}
1481+
}'
14701482
14711483
### Code samples for experimental features
14721484
experimental_get_metrics_1: |-

docs.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,8 @@
342342
"reference/api/dump",
343343
"reference/api/experimental_features",
344344
"reference/api/metrics",
345-
"reference/api/logs"
345+
"reference/api/logs",
346+
"reference/api/export"
346347
]
347348
},
348349
{

reference/api/export.mdx

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
---
2+
title: Export
3+
description: "Migrate between instances with the `/export` route"
4+
---
5+
6+
import { RouteHighlighter } from '/snippets/route_highlighter.mdx'
7+
8+
import CodeSamplesExperimentalDeleteLogsStream1 from '/snippets/samples/code_samples_experimental_delete_logs_stream_1.mdx';
9+
10+
Use the `/export` route to transfer data from your origin instace to a remote target instance. This is particularly useful when migrating from your local development environment to a Meilisearch Cloud instance.
11+
12+
## Migrate database between instances
13+
14+
<RouteHighlighter method="POST" path="/export" />
15+
16+
Migrate data from the origin instance to a target instance.
17+
18+
### Body
19+
20+
| Name | Type | Default value | Description |
21+
| ------------------- | ------ | ------------- | --------------------------------------------------------------------------------------------------------- |
22+
| **`url`** * | String | `null` | The target instance's URL address. Required |
23+
| **`apiKey`** * | String | `null` | An API key with full admin access to the target instance |
24+
| **`payloadSize`** * | String | "50 MiB" | A string specifying the payload size in a human-readable format |
25+
| **`indexes`** * | Object | `null` | A set of patterns matching the indexes you want to export. Defaults to all indexes in the origin instance |
26+
27+
#### `url`
28+
29+
A string pointing to a remote Meilisearch instance, including its port if necessary.
30+
31+
This field is required.
32+
33+
#### `apiKey`
34+
35+
A security key with full admin permissions to a secured Meilisearch instance.
36+
37+
#### `payloadSize`
38+
39+
The maximum size of each single data payload in a human-readable format such as `"100MiB"`. Larger payloads are generally more efficient, but require significantly more powerful machines.
40+
41+
#### `indexes`
42+
43+
A set of objects whose keys correspond to patterns matching the indexes you want to export. By default, Meilisearch exports all documents across all indexes.
44+
45+
Each index object accepts the following fields:
46+
47+
- `filter`: a [filter expression](/learn/filtering_and_sorting/filter_expression_reference) defining the subset of documents to export. Optional, defaults to `null`
48+
- `overrideSettings`: if `false`, uses the index settings as configured in the origin instance. if `true`, uses the target instance settings. Optional, defaults to `false`.
49+
50+
### Example
51+
52+
<CodeSamplesExportPost1 />
53+
54+
#### Response
55+
56+
```json
57+
{
58+
"taskUid": 2,
59+
"indexUid": null,
60+
"status": "enqueued",
61+
"type": "export",
62+
"enqueuedAt": "2025-06-26T12:54:10.785864Z"
63+
}
64+
```

reference/errors/error_codes.mdx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,26 @@ The [`offset`](/reference/api/documents#query-parameters) parameter is invalid.
184184

185185
The provided `_geo` field of one or more documents is invalid. Meilisearch expects `_geo` to be an object with two fields, `lat` and `lng`, each containing geographic coordinates expressed as a string or floating point number. Read more about `_geo` and how to troubleshoot it in [our dedicated guide](/learn/filtering_and_sorting/geosearch).
186186

187+
## `invalid_export_url`
188+
189+
The export target instance URL is invalid or could not be reached.
190+
191+
## `invalid_export_api_key`
192+
193+
The supplied security key does not have the required permissions to access the target instance.
194+
195+
## `invalid_export_payload_size`
196+
197+
The provided payload size is invalid. The payload size must be a string indicating the maximum payload size in a human-readable format.
198+
199+
## `invalid_export_indexes_patterns`
200+
201+
The provided index pattern is invalid. The index pattern must be an alphanumeric string, optionally including a wildcard.
202+
203+
## `invalid_export_index_filter`
204+
205+
The provided index export filter is not a valid [filter expression](/learn/filtering_and_sorting/filter_expression_reference).
206+
187207
## `invalid_facet_search_facet_name`
188208

189209
The attribute used for the `facetName` field is either not a string or not defined in the [`filterableAttributes` list](/reference/api/settings#filterable-attributes).

0 commit comments

Comments
 (0)