您只需要用分号分隔每个语句:
"script": { "script": "isCompleted = doc['state'].value == 'completed'; preSLA = doc['lastStateUpdate'].value < doc['dueDate'].value; return isCompleted && preSLA;" }不过,请确保不要在脚本字符串中添加换行符,因为它不是有效的JSON。

您只需要用分号分隔每个语句:
"script": { "script": "isCompleted = doc['state'].value == 'completed'; preSLA = doc['lastStateUpdate'].value < doc['dueDate'].value; return isCompleted && preSLA;" }不过,请确保不要在脚本字符串中添加换行符,因为它不是有效的JSON。