Updated on 2025-05-08 GMT+08:00

Script

The script processor is used to process data. You can use a specified programming language to compile a script, process the data transferred to the script processor, and generate new data for subsequent steps.

Configuration Parameters

Parameter

Description

Script Language

Programming language used for writing scripts. Currently, only JavaScript of the ES6 version is supported. For details, see the official document of the ES6.

Script Content

Compile the script content.

You can reference data from previous nodes. For details, see Referencing Variables.

Format:

// This method is the script execution entry.

// The input data includes payloads and properties, representing the output data of each node.

// Example: data.payloads['357123'], data.properties['357123'].id, where 357123 indicates the node ID.

function execute(data) {

return data;

}

You can access object attributes directly using data.payloads or data.properties['357123'], such as with JSON data. There is no need to use JSON.parse(). The JSON object is already parsed and ready to use.

If you need to write a function or logic code block, use braces ({}) to surround the code block.

Constraints

New features:

  • node:crypto
  • WebCrypto(crypto.subtle)
  • Elasticsearch 2023 type
  • Operators
  • Private objects
  • Object
  • String
  • Numbers
  • Built-in objects
  • For details, see the Elasticsearch 2023 development guide.

Unsupported features:

  • Network access
  • Environment variables
  • Process access
  • File system access
  • Dynamic code evaluation
  • Restricted features