Icon indexing white

Indexing Overview

Last updated 25 September 2017

Overview

While indexing can be accomplished in a few different ways, the recommended method is to import existing data from a database into Algolia using an API client. Indexing programmatically gives you more power and makes it easier to keep your data up to date. However, importing your data directly via the dashboard can be useful to get up and running quickly.

Indexing via the API

To index your existing data for the first time, you will need to iterate through your records and send them to Algolia’s servers. You may find you need to retrieve your records from a database, from a file, or from the source code directly. If you need to transform any of your data (for example, formatting clean up or applying logic to generate attributes that will be used for the custom ranking field) you will need to complete this work before sending the records to Algolia. After your data is Algolia-ready, you can push it to Algolia using the Add objects method.

var objects = [{
  objectID: '1',
  firstname: 'Jimmie',
  lastname: 'Barninger'
}, {
  objectID: '2',
  firstname: 'Warren',
  lastname: 'Speach'
}];
    
index.addObjects(objects, function(err, content) {
  console.log(content);
});

Custom ObjectIDs

If your objects have unique IDs and you would like to use them to make future updates easier, you can specify the objectID in the records you push to Algolia. The value you provide for objectIDs can be an integer or a string. If you don’t provide this attribute, Algolia will generate one for each record, like "228506501".

Batching

For optimal indexing performance, we strongly encourage you to send your records in batches. We recommend a batch size of ~10MB, which represents between 1,000 or 10,000 records depending on the average record size.

This has multiple benefits: it reduces network calls and it increases indexing performance. Customers with the largest number of records, such as those on the Enterprise or Pro plans, will see the biggest impact on performance, but all customers are recommended to send indexing operations in batches where possible.

Indexing via the Dashboard

After you’ve created an Algolia index, you’ll be able to add records to it through the dashboard.

On the right-hand side of your index browse page, you have an option to add records manually (using the JSON format) or by uploading a file, which can be a JSON, a CSV, or a TSV and must be below 50MB.

Drop file dashboard

This is mostly useful for quick experimentation, but it’s not recommended for an implementation in production.

Indexing from a Third-Party Platform

We’ve built several extensions in order to simplify the indexation process for popular third-party platforms. If you’re using one of the platforms listed below, we recommend installing our extension and leveraging its capabilities for indexing your content.

What’s next

Continue building your Algolia knowledge with these concepts:

If you want to go ahead and start pushing some data, here are a few tutorials that can help:

© Algolia - Privacy Policy