Guides / Sending and managing data / Send and update your data

Transform your data without code

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.

No Code transformations are defined through a form-based interface.

You can only add one transformation to a destination.

Get started with NoCode 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 function, click Create transformation, and select ‘Transform without code’
  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 that you configure. Each step can optionally 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 type Description
Add record attribute Add a new attribute to a record. The value can be a fixed value or calculated from other attributes in the record
Remove record attribute Remove an attribute from a record
Remove records Remove 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. Here’s how to configure this step:

Adding an attribute to a record

Adding an attribute to a record.

  1. Choose Add Attribute as the step type
  2. Enter the name of the attribute you want to add. You can also specify an existing attribute to update its value. For nested attributes, use dot notation (for example, prices.discount_pct).
  3. Optional: Add a condition to control when this step is applied
  4. Set the value for the attribute. This can be:
    • A static value (for example, true, 10, or "new")
    • A computed value based on other attributes in the record (for example, price * discount_pct). See Computed values for more information

If you specify an attribute that already exists, its value will be overwritten.

Computed values

The value you assign to an attribute can be a computed value.

A computed value can be based on other attributes in the record. For example, if you want to calculate the discounted price of a product, you can use the following formula:

price * (1 - discount_pct)

Where price is an attribute in the record and discount_pct is another attribute in the record.

A number of functions are available to help you calculate computed values, covering common operations like arithmetic, string manipulation, and date/time calculations.

See the Function reference for a full list of available functions.

Remove Attribute step

Use the Remove 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.

Removing an attribute from a record

Removing an attribute from a record.

  1. Choose Remove Attribute as the step type
  2. Enter the name of the attribute you want to remove. For nested attributes, use dot notation (for example, prices.discount_pct).
  3. Optional: Add a condition to control when this step is applied

If you specify a nested attribute using dot notation, only that nested field will be removed, not the entire object.

Remove records step

Use the Filter 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.

Remove records based on a condition

Remove records based on a condition.

  1. Choose Filter Records as the step type
  2. Optional: Add a condition to control when this step is applied. Only records that meet these conditions will be kept; others will be removed

Conditions

Conditions let you control when a transformation step runs for a particular record. They are used in both the Add Attribute and Filter Records steps:

  • Add Attribute: Only add or modify an attribute if the condition is met.
  • Filter Records: Only keep records that meet the condition; others are filtered out.
  • Remove Records: Only remove records that meet the condition; others are kept.

What makes up a condition?

A condition is defined using a form-based interface and consists of:

  • Field: The attribute of the record to check (for example, category, price)
  • Operator: The comparison to perform (for example, equals, does not equal, less than, less than or equal, greater than, greater than or equal)
  • Attribute type: The data type of the field (for example, string, number, boolean). This tells the condition how to compare the field to the value
  • Value: The value to compare against (for example, "food", 200, true)

Example: A basic condition

The following condition checks if the category field equals "food":

A basic condition

An example of a basic condition.

Combining 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 together, this is similar to using parentheses in a formula.

  • category equals "food" AND (price < 200 OR discount == true)

A complex condition

An example of a complex, grouped condition.

Tip: Grouping conditions changes the order in which conditions are evaluated, allowing for advanced logic.

Supported types

The following attribute types are supported:

Attribute Type Description
string A string of text, for example: “food”
number A number, for example: 200
boolean A boolean value, for example: true or false

Array and object types are not currently supported in No Code transformations.

Conditions summary

  • Use conditions to precisely control when transformation steps apply
  • Combine and group conditionals for advanced logic
  • Visualize and build conditions easily with the form-based interface

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 does not 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 a subset of data sources. The following data sources support sampling:
    • Algolia Index
    • CSV
    • JSON
  • Edits to a transformation do not support sampling
  • You can only use either no code or code transformations, not both, for a given task
  • Transforming complex records structures (arrays and objects) is not supported

Function reference

Various functions are available to help you calculate computed values, covering common operations like arithmetic, string manipulation, and date/time calculations.

Some examples include:

Function Description Example 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 values max(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"

For a full list of available functions, see the Expr language documentation.

Did you find this page helpful?