Before you begin
Make sure you have an Algolia account. Create one for free if you don’t already have one.Set up the JSON connector
Create a source, destination, transformation, and synchronization task for the sample product dataset.- The source tells the connector where to fetch the JSON file.
- The destination tells the connector which Algolia index to write to.
- The transformation enriches records.
- The task controls when the connector runs.
1
Create a JSON connector
Connect the JSON source for the hosted sample product dataset.
- Go to the Algolia dashboard and select your Algolia application.
- Go to the Connectors page in the Algolia dashboard.
- Select the JSON connector and click Connect.
2
Configure the source URL
- Select None as your authentication method under Is your data source protected?.
- In URL, enter
https://dashboard.algolia.com/api/1/sample_datasets?type=apparel. - Select GET as the HTTP Method.
3
Set the unique property identifier
- In Unique property identifier, enter
objectID. - In Connector name, enter
Quickstart products JSON source. - Select Create source.
4
Transform the records
This transformation adds a
price_range attribute to each record.
After the connector indexes your records, you can display price_range or configure it as a facet.-
Select Transform using the code editor and replace the placeholder Transformation code with this function:
JavaScript
-
Preview the transformation and confirm that the output record includes
price_range. - Save the transformation.
5
Create the destination index
Choose the Algolia index where the connector stores the product records.
-
Under Connect your data to Algolia Search, enter
quickstart-products. -
Under Index credentials, select Create one for me. To use an existing key, choose one with the
addObject,deleteIndex, andeditSettingsACLs. -
In Name, enter
Quickstart products destination. - Select Create destination.
6
Create an on-demand synchronization task
Ensure On demand and Full reindexing are selected.
7
Run the task
- Select Create task and then Run.
- Wait for the task to finish.
8
Verify the indexed records
When the task completes, open the
quickstart-products index in the Algolia dashboard.
The index contains product records with attributes such as title, description, product_type, price, price_range, and showcase_image.You can use this index as the data source for Build your first search experience.
Before you start the UI steps in that quickstart, configure
product_type as a facet for the quickstart-products index.Index your own JSON data
To index your own records, update the connector source URL to point to a JSON file you host. After updating the source, run the task again to index your records.Source file format
Your JSON file must contain an array of JSON objects. For example:JSON
id in this example).
In the source configuration, set Unique property identifier to that property so the connector can use it as the Algolia objectID.
Source file location
Update the connector source URL to point to your hosted JSON file. The source URL can usehttp, https, ftp, ftps, or sftp.
For http or https sources, choose the request method your server expects:
- GET if your server returns the JSON file from a standard request.
- POST if your server requires a POST request.
Authentication
Select the authentication method for your file:- None if the file is public.
- Basic Auth if the file requires a username and password.
Transformations
Use the transformation to add computed attributes before the connector indexes your records. If you want to search, facet, or rank by a computed attribute, update the relevant index settings, such assearchableAttributes, attributesForFaceting, or customRanking.
Schedule
Choose when the connector fetches your data:- On demand. The connector only fetches data when you manually run it from the Algolia dashboard’s Tasks page.
- Scheduled. The connector runs on a schedule. Select a schedule from the list or enter a custom schedule with a cron expression.