Skip to main content
You can add transformations to your connector’s destination to manipulate data before it’s written to your Algolia indices. To use transformations, create a task that specifies the data source and the destination (usually an Algolia index). Add transformations during task creation or apply them directly to existing destinations. To learn more about connectors, read the Connectors overview.

Get started with no-code transformations

  1. Go to the Algolia dashboard and select your Algolia application.
  2. On the left sidebar, select Data sources.
  3. Open the Connectors page.
  4. Select a connector and click Connect to start creating your task.
  5. Configure your data source: create a new source or select an existing one.
  6. To create your transformation, click Create a new transformation and select Transform without code. To learn more about the available transformation steps, see Create your transformation.
  7. Configure your destination: create a new destination or select an existing one.
  8. Configure when your task should run and specify the operation type for writing your Algolia index records.
  9. Confirm whether you want to run your task immediately. To see your transformation in action, click Run and inspect your index records after the task finishes.

Create your transformation

A no-code transformation consists of one or more steps. Each step can include a condition, so it only applies to records that meet specific criteria. If any of the steps fail, the entire transformation will be marked as failed.

Available step types

Step typeDescription
Add record attributeAdds a new attribute to a record.
The value can be a fixed value or calculated from other attributes in the record.
Remove record attributeRemoves an attribute from a record.
Remove recordsRemoves records based on a condition.
For example, you can remove records with a price below a certain threshold.

Add Attribute step

Use the Add Attribute step to create a new attribute in your records, or to update the value of an existing one: Form with fields for assigning or creating attributes, building conditions to select a subset of records, or for computing attributes
  1. On the Transformation page, select Create Attribute.
  2. Enter the name of the attribute you want to add or update. If the attribute doesn’t exist yet, its added to each matching record. If the attribute already exists, its value is replaced. If you enter an existing attribute, the values are updated. Use dot notation for nested attributes, such as prices.discount_pct.
  3. Optional: Add a condition to select the records for adding or updating attributes.
  4. Specify the value for the new or updated attribute:
    • To assign the same value to each record matching the conditions, enter a value, for example, true, 10, or new.
    • To assign a computed value based on other attributes, enter a formula, for example, price * discount_pct. To learn more, see Computed values.

Computed values

Computed values are based on other record attributes. For example, to calculate the discounted price of a product, use the formula: price * (1 - discount_pct), where price and discount_pct are attributes in the record. For a list of available functions you can use to compute values, see Function reference.

Delete Attribute step

Use the Delete Attribute step to delete an attribute from your records. This is useful for cleaning up data or removing fields you don’t want to send to your Algolia index. Form with fields for seleting an attribute to delete and for building conditions to select a subset of records
  1. Select Delete Attribute as the step type.
  2. Enter the name of the attribute you want to delete. For nested attributes, use dot notation, for example, prices.discount_pct. Only that nested field will be deleted, not the entire attribute.
  3. Optional: Add a condition to determine from which records the attribute is removed.

Remove records step

Use the Remove Records step to remove records from your index based on specific conditions. This is useful for excluding records that don’t meet your criteria before sending them to your Algolia index. Form with fields for building conditions to select a subset of records to delete
  1. Choose Remove Records as the step type.
  2. Add a condition to determine which records to remove.

Conditions

Conditions let you control when a transformation step runs for a particular record:
  • Add Attribute: Only add or modify an attribute to records that meet the conditions.
  • Delete Attribute: Only delete attributes from records that meet the conditions.
  • Remove Records: Only remove records that meet the conditions.

Parts of conditions

Conditions consist of the following elements:
  • Field. The attribute to check, for example, category or price.
  • Operator. The comparison to perform, for example, equals, does not equal, or greater than.
  • Attribute type. The data type of the field: String, Number, or Boolean. This specifies how to compare the field to the value.
  • Value. The value to compare the field against, for example, "food", 200, or true.

Example: a basic condition

  • Field: category
  • Operator: Equals
  • Type: String
  • Value: Food
This condition selects records where the category attribute has the value Food. A basic condition

Multiple conditionals

You can combine multiple conditionals using AND and OR logic. For example:
  • category equals "food" AND price < 200
For more complex logic, you can group conditionals. This is similar to using parentheses in a formula.
  • category equals "food" AND (price < 200 OR discount == true)
A complex condition
Grouping conditions changes the order in which conditions are evaluated, allowing for complex logic.

Supported attribute types

TypeDescription
StringA string of text, for example: food
NumberA number, for example: 200
BooleanA boolean value: true or false
Array and object types are not supported in no-code transformations.

Preview your transformation

At any point during setup, you can preview your transformation. The preview feature lets you apply your transformation to a sample of your data, so you can compare the results before and after the changes. If you data source doesn’t support previewing, you can still preview your transformation by copying a sample record into the text area available in preview.
Not all data sources support previewing.

Limitations

  • You can only add one transformation to a destination.
  • Support for data sampling in preview is limited to these data sources:
    • Algolia index
    • CSV
    • JSON
  • Edits to a transformation don’t support sampling.
  • In a given task, you can use either no-code or code transformations, not both.
  • Transforming complex records structures (arrays and objects) isn’t supported.

Function reference

The following table lists available functions for computed values. To learn more, see the Expr language documentation.
FunctionDescriptionExample usage
mean([x, y, ...)]Returns the mean of the numbers.mean([1, 2, 3])2
median([x,y, ...])Returns the median of the numbers.median([1, 2, 3])2
round(x)Rounds x to the nearest integer.round(2.5)3
max(a, b)Returns the largest of two valuesmax(1, 5)5
min(a, b)Returns the smallest of two values.min(1, 5, 3)1
len(x)Returns the length of a string.len("abc")3
lower(x)Converts a string to lowercase.lower("HELLO")"hello"
upper(x)Converts a string to uppercase.upper("hello")"HELLO"
replace(s, old, new)Replace all occurrences of old with new in s.replace("foo", "o", "a")"faa"
trim(str[,chars])Trim whitespace from start and end of string. Optionally trim chars.trim(" foo ")"foo"
split(s, sep)Splits string s into an array using separator sep.split("a,b,c", ",")["a","b","c"]
join(arr, sep)Joins elements of array arr into a string, separated by sep.join(["a","b"], ",")"a,b"
uniq([x,y,...])Removes duplicate values from an array.uniq([1, 2, 2, 3])[1, 2, 3]
now()Returns the current time.now()"2024-06-07T12:34:56Z"
I