> ## Documentation Index
> Fetch the complete documentation index at: https://upstash.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Database Migrator

> a CLI tool to migrate your data to Upstash Search

## Introduction

This tool helps you to migrate your data from other service providers (e.g. Algolia, Meilisearch)
to your Upstash Search Database.

### Migrate Using npx

The command below prompts you to provide credentials for the indexes that you want to do the migration between.

```sh theme={"system"}
npx @upstash/search-migrator
```

### Using Flags

You can also provide your credentials and other information as command-line flags.
Here are some examples:

#### Algolia to Upstash

```sh theme={"system"}
npx @upstash/search-migrator \
  --upstash-url "UPSTASH_SEARCH_REST_URL" \
  --upstash-token "UPSTASH_SEARCH_REST_TOKEN" \
  --algolia-app-id "YOUR_ALGOLIA_APP_ID" \
  --algolia-api-key "YOUR_ALGOLIA_WRITE_API_KEY"
```

#### Meilisearch to Upstash

```sh theme={"system"}
npx @upstash/search-migrator \
  --upstash-url "UPSTASH_SEARCH_REST_URL" \
  --upstash-token "UPSTASH_SEARCH_REST_TOKEN" \
  --meilisearch-host "YOUR_MEILISEARCH_HOST" \
  --meilisearch-api-key "YOUR_MEILISEARCH_API_KEY"
```

## Obtaining Credentials

### Upstash

1. Go to your [Upstash Console](https://console.upstash.com/).
2. Select your Search Database.
3. Under the **Details** section, you will find your `UPSTASH_SEARCH_REST_URL` and `UPSTASH_SEARCH_REST_TOKEN`.
   * `--upstash-url` corresponds to `UPSTASH_SEARCH_REST_URL`.
   * `--upstash-token` corresponds to `UPSTASH_SEARCH_REST_TOKEN`.

* You may want to check out
  [@upstash/search-migrator](https://www.npmjs.com/package/@upstash/search-migrator)
  to see how to find credentials for other service providers

## Migration Process

The migrator will:

1. **Connect** to your source database (Algolia or Meilisearch)
2. **Fetch** all documents from the specified index
3. **Transform** the data to match Upstash Search's format
4. **Upload** the documents to your Upstash Search database
5. **Verify** the migration by comparing document counts

### Data Transformation

The migrator automatically handles the transformation of your data:

* **Document IDs**: Preserved from the source
* **Content**: Mapped to Upstash Search's content field
* **Metadata**: Preserved as metadata in Upstash Search
* **Searchable fields**: All fields become searchable by default

<Note>
  For free tier, 10000 documents can be upserted daily,
  so a database migration with more than 10000 entries could
  be interrupted.
</Note>

### Getting Help

If you encounter any issues during migration:

1. Check the error messages for specific details
2. Verify your credentials are correct
3. Ensure your source database is accessible
4. Contact support at [support@upstash.com](mailto:support@upstash.com)

## Final Remarks

If you've come to this point without any issues, congratulations! you may resume your work
with upstash search, an advanced, developer frinedly search product.

For further insights, please visit [@upstash/search-migrator](https://www.npmjs.com/package/@upstash/search-migrator)
