window.first
支持的语言:
window.first(values_to_sort_by, values_to_return)
说明
此聚合函数会返回一个字符串值,该值源自匹配窗口中相关性最低的整数值对应的事件。一个用例示例是,从匹配窗口中时间戳最低(最早)的事件中获取用户 ID。
形参数据类型
INT,STRING
返回类型
STRING
代码示例
获取在匹配窗口中与最低相关整数值对应的事件派生的字符串值。
// This rule sets the outcome $first_event to the lowest correlated int value
// in the 5 minute match window.
events:
$e.user.userid = $userid
match:
$userid over 5m
outcome:
$first_event = window.first($e.metadata.timestamp.seconds, $e.metadata.event_type) // yields v1 if the events in the match window are 1, 2 and 3 and corresponding values v1, v2, and v3.