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 accomplish this, you can leverage the browse method with one of our API clients.

We currently don’t provide a way to export index data from the Algolia dashboard directly, since indices can potentially be quite large.

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 indicate that you want 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, we recommend that you chunk the data.

Did you find this page helpful?