10 long now = System.currentTimeMillis();
11 if (doc.get('closedLoopEventStatus.keyword').value == 'ABATED') {
12 return now - doc.get('closedLoopAlarmEnd').value;
14 if (doc.get('closedLoopEventStatus.keyword').value == 'ONSET') {
15 return now - doc.get('closedLoopAlarmStart').value;
17 if (doc.containsKey('notification.keyword')) {
18 return now - doc.get('notificationTime').value;
25 , "closedLoopAlarmStart" : {
28 "source": "doc['closedLoopAlarmStart']"
31 , "closedLoopEventStatus" : {
34 "source": "doc['closedLoopEventStatus.keyword']"
40 "source": "doc['notification.keyword']"
43 , "notificationTime" : {
46 "source": "doc['notificationTime'].value"