Virtual

Field value generated by a script. Uses the document fields to produce a double value.

message Field {
    string name = 1;
    FieldType type = 2;
    Script script = 16;
}
  • name: Name of the field.

  • type: Type of the field. Must be set to VIRTUAL.

  • script: Script to generate the field value.

Example

{
    "name": "virtual_field",
    "type": "VIRTUAL",
    "script": {
        "lang": "js"
        "source": "field1 + field2"
    }
}