window.first

נתמך ב:
window.first(values_to_sort_by, values_to_return)

תיאור

פונקציית הצבירה הזו מחזירה ערך מחרוזת שנגזר מאירוע עם ערך ה-int הכי נמוך שקשור לחלון ההתאמה. מקרה שימוש לדוגמה: קבלת מזהה המשתמש מהאירוע עם חותמת הזמן הכי נמוכה בחלון ההתאמה (האירוע המוקדם ביותר).

סוגי נתונים של פרמטרים

INT, STRING

סוג הערך שמוחזר

STRING

דוגמאות קוד

הפונקציה מחזירה ערך מחרוזת שנגזר מאירוע עם ערך ה-int הכי נמוך שקשור לחלון ההתאמה.

// 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.