Guides / Sending and managing data / Manage your indices

Exporting and Importing Algolia Indices

You can’t export records from the Algolia dashboard, only your index configuration. To export records, you must use an API client.

Exporting the index using an API client

Sometimes you may need to export your Algolia index, to use the data in some other way. To do this, use the browse method with one of the API clients.

The browse method lets you retrieve records beyond the 1,000 default limit of the search method.

Use an empty query to retrieve all records. Once you have the records, save them to a file.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// composer autoload
require __DIR__ . '/vendor/autoload.php';

// if you are not using composer
// require_once 'path/to/algoliasearch.php';

$client = Algolia\AlgoliaSearch\SearchClient::create('YourApplicationID', 'YourAdminAPIKey');
$index = $client->initIndex('your_index_name');

$objects = [];

foreach ($index->browseObjects() as $hit) {
    $objects[] = $hit;
}

file_put_contents('your_filename', json_encode($objects));

When exporting large indices, batch the records for optimal performance.

Importing the index

You can import records from your data file into a new index with the dashboard or by using the saveObjects method.

You can also import an exported index configuration file from Indices > Browse > Manage index > Import Configuration.

Exporting and importing index configuration data

You can export various index configuration options into a file. This file contains that index’s values for:

To export the configuration file, select an index from the Indices section, click the Manage index button, and choose Export configuration. You can decide to export one or more of Settings, Synonyms, or Rules. The configuration file is in JSON format.

Exporting configuration data using the API

Importing index configuration data from the dashboard

To import index configuration settings from an exported JSON file:

  1. Select an index from the Indices section, click the Manage index button, and choose Import configuration.
  2. Upload your file.
  3. Choose how you want to import your data by clicking one or more of Settings, Synonyms or Rules. For Synonyms and Rules you can determine if your index values will be either overwritten (cleared and replaced) or updated.
  4. Type IMPORT and then click Import Configuration to start the process.

Importing configuration data using the API

Did you find this page helpful?