Guides / Sending and managing data / Manage your indices

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

You can’t export index data from the Algolia dashboard, you need to use an API client.

Exporting the index

The browse method lets you retrieve records beyond the 1,000 default limit of the search method. You can use an empty query to retrieve all records.

Once you have them, you can 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, you should chunk the data for optimal performance.

Did you find this page helpful?