aboutsummaryrefslogtreecommitdiffstats
path: root/extra/docker/elk/tools/EsAutoQuery/closedLoopAlarmDuration.json
blob: 5a295454b4a29e5e6584c96bc787694355be16c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
{
    "query" : {
        "bool": {
            "must": [
                { "match": { "closedLoopEventStatus": "ABATED" } }
            ]
        }
    },
    "script_fields" : {
        "closedLoopAlarmDuration" : {
            "script" : {
                "lang": "painless",
                "source": "
if (doc.get('closedLoopEventStatus.keyword').value == 'ABATED') {
   return doc.get('closedLoopAlarmEnd').value - doc.get('closedLoopAlarmStart').value;
}
return null
"
            }
        }
        , "closedLoopAlarmStart" : {
            "script" : {
                "lang": "painless",
                "source": "doc['closedLoopAlarmStart']"
            }
        }
        , "closedLoopAlarmEnd" : {
            "script" : {
                "lang": "painless",
                "source": "doc['closedLoopAlarmEnd']"
            }
        }
    }
}