As you found out later, the value of a pipeline parameters is a string. In order to evaluate it, you’ll need to use the ‘eval()’ function, like so:
eval(_field1)
Alternatively, you can put the expression in a file and import that file as a library (see Expression Library). Your library file would contain an object with a field that contains your function, like so:
{
extract: doc => {id:id}.extend(doc.fieldValues.map (elem => [elem.id, elem.type, elem.value]))
}
You can then execute that function in your mapper with an expression like this:
lib.mylib.extract($)