A snapshot is an exact copy of the Meilisearch database, located by default in ./ Snapshots are useful as quick backups.

    Since databases are bound to the Meilisearch version that created them and snapshots are direct copies of the database, you cannot use snapshots to migrate data when upgrading Meilisearch.

    Creating snapshots

    Creating a single snapshot

    Use the /snapshots route to generate a single snapshot:

    curl \
      -X POST 'http://localhost:7700/snapshots'

    This will return a summarized task object. Use the /tasks route to monitor the status of this operation.

    Scheduling periodic snapshots

    Use the --schedule-snapshot configuration option to create snapshots at regular time intervals:

    meilisearch --schedule-snapshot

    The first snapshot is created on launching Meilisearch. After that, snapshots are created on a set interval until you deactivate snapshots by ending the Meilisearch instance. By default, one snapshot is taken every 24 hours.

    Modify the interval between each new snapshot by providing an integer to --schedule-snapshot:

    meilisearch --schedule-snapshot=3600

    Learn more about snapshots flags and environment variables.

    Snapshot directory

    By default, Meilisearch creates snapshots in a directory called snapshots/ at the root of your project.

    The destination can be modified with --snapshot-dir:

    meilisearch --schedule-snapshot --snapshot-dir mySnapShots/

    Old snapshots are automatically overwritten during snapshot creation. Only the most recent snapshot will be present in the folder at any given time.

    Starting from a snapshot

    Because snapshots are exact copies of your database that haven't gone through any processing besides compression, starting a Meilisearch instance from a snapshot is significantly faster than adding documents manually or starting from a dump.

    Using the CLI flag --import-snapshot, Meilisearch will start the server using the provided snapshot.

    meilisearch --import-snapshot mySnapShots/

    Common problems

    Take note that whenever you launch Meilisearch from a snapshot, it will stop processing and throw an error if it encounters either of the two following situations:

    1. A database already exists, meaning you have a non-empty folder in the same directory as your Meilisearch binary
    2. No snapshot is found at the given path

    In both cases, this behavior is configurable.

    If you don't want Meilisearch to throw an error when finding that a database already exists, you can add the following flag: --ignore-snapshot-if-db-exists=true. When using this flag, Meilisearch will use the existing database to start an instance instead of throwing an error. The snapshot will be ignored.

    If you do not want Meilisearch to throw an error when there is no snapshot at the given path, you can add the following flag: --ignore-missing-snapshot. Meilisearch will then continue its process and not import any snapshot.

    When starting from a snapshot, chances are that you already have an existing database. For security reasons, a database is never overwritten. To load a snapshot when an existing database is present, you will have to manually delete the existing database. By default, this is the contents of the folder (unless you changed the path) which is located in the same folder as your Meilisearch binary. The simplest way to delete your database is with the terminal command rm -rf, after which you should be able to start Meilisearch with a snapshot.

    [More about snapshots flags and environment variables]

    Use cases

    Snapshots are safeguards in case of problems. If your Meilisearch instance encounters a problem or if you make a mistake while manipulating your database, restarting your instance with the latest snapshot is an easy way to recover your data.

    Version compatibility

    Since a snapshot is an exact replica of your database, it can only be opened by the same version of Meilisearch that created it.