We are happy to announce the release of new mapper which is using JSONata as a transformation language. This article guides you through the most important changes in the mapping language and how to migrate your flows. Let's start with the most significant changes first.

Referencing properties in messages

Before this release, you used {{propertyName}} to reference a property inside a message while mapping. An example is shown below:


Now you reference properties without wrapping them into brackets, as shown below:


String concatenation

Before this release, our mapper did not differentiate between data types. Everything was considered as Strings. For example, the following mapping expression was evaluated to a String:

First Name: {{firstName}}

The new mapping language is very strict with types. First of all, Strings must be quoted, as you are probably used from all programming languages. Secondly, the concatenation is done explicitly by using the & operator. Here is an example:

"First Name: " & firstName

Line breaks

If your mapping target is a TextArea field, you might need line breaks. The new mapper does introduce new lines explicitly. Please use & "\n" & for a line break, as shown below:

"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
& "\n" & "<shiporder account-name=\"" & Account."Account Name" &"\">"
& "\n" &  "<price total=\"" & $sum(Account.Order[].Product[].Price) & "\" average=\"" & $average(Account.Order[].Product[].Price) & "\"/>"
& "\n" & "<shiporder>"

No splitting

Before the release, the following mapping expression was split on each array. In the following example on Orders and on Products.


The new mapper does not split at all. If you want to split messages by arrays, please use our Splitter component beforehand.

Migrating your flows to use the new mapping language

In order to migrate your flow to use the new mapping language, you need to create a copy of your flow. This can be accomplished by the following steps:

  1. Copy the curl command presented on the flow's detail page.
  2. In the payload, you will find the default_mapper_type property and multiple occurrences of mapper_type property. All of them have the value handlebars. Please change the value to jsonata.
  3. Now make a copy of the flow by executing the curl command on the terminal.
  4. Find your new copy of the flow in the dashboard and start editing it.
  5. From now on you will be able to use the new mapping language only.
  6. Finish the flow configuration and test it.
  7. Once your copy is ready you can delete the original flow

If you need more help, please contact our support.

To Fallback

In case you encounter any issues with the new mapper and would like to switch back to the old mapper with handlebars then you can issue this API call to patch your flow:

curl https://api.elastic.io/v2/flows/{FLOW_ID} \                                                       
   -X PATCH \
   -u {EMAIL}:{API_SECRET} \
   -H 'Accept: application/json' \
   -H 'Content-Type: application/json' -d '
          "data": {
            "type": "flow",
            "id": "{FLOW_ID}",
            "attributes": {
              "default_mapper_type": "handlebars"

Please note that this API call would switch back the mapper type for only one flow.

For more information please consult our API documentation.