@@ -680,7 +680,6 @@ count:long | category:keyword | client_ip:ip
680680 4 | null | 172.21.3.15
681681;
682682
683-
684683multiple groupings with categorize and the same text field
685684required_capability: categorize_multiple_groupings
686685
@@ -696,3 +695,49 @@ count:long | category:keyword | message:keyword
696695 3 | .*?Connection.+?error.*? | Connection error
697696 1 | .*?Disconnected.*? | Disconnected
698697;
698+
699+ multiple additional complex groupings with categorize
700+ required_capability: categorize_multiple_groupings
701+
702+ FROM sample_data
703+ | STATS count=COUNT(), duration=SUM(event_duration) BY category=CATEGORIZE(message), SUBSTRING(message, 1, 7), ip_part=TO_LONG(SUBSTRING(TO_STRING(client_ip), 8, 1)), hour=BUCKET(@timestamp, 1 HOUR)
704+ | SORT ip_part, category
705+ ;
706+
707+ count:long | duration:long | category:keyword | SUBSTRING(message, 1, 7):keyword | ip_part:long | hour:datetime
708+ 1 | 1232382 | .*?Disconnected.*? | Disconn | 0 | 2023-10-23T13:00:00.000Z
709+ 2 | 6215122 | .*?Connected.+?to.*? | Connect | 2 | 2023-10-23T12:00:00.000Z
710+ 1 | 1756467 | .*?Connected.+?to.*? | Connect | 3 | 2023-10-23T13:00:00.000Z
711+ 3 | 14027356 | .*?Connection.+?error.*? | Connect | 3 | 2023-10-23T13:00:00.000Z
712+ ;
713+
714+ multiple groupings with categorize and some constants including null
715+ required_capability: categorize_multiple_groupings
716+
717+ FROM sample_data
718+ | STATS count=MV_COUNT(VALUES(message)) BY category=CATEGORIZE(message), null, constant="constant"
719+ | SORT category
720+ ;
721+
722+ count:integer | category:keyword | null:null | constant:keyword
723+ 3 | .*?Connected.+?to.*? | null | constant
724+ 1 | .*?Connection.+?error.*? | null | constant
725+ 1 | .*?Disconnected.*? | null | constant
726+ ;
727+
728+ multiple groupings with categorize and aggregation filters
729+ required_capability: categorize_multiple_groupings
730+
731+ FROM employees
732+ | STATS lang_low=AVG(languages) WHERE salary<=50000, lang_high=AVG(languages) WHERE salary>50000 BY category=CATEGORIZE(job_positions), gender
733+ | SORT category, gender
734+ | LIMIT 5
735+ ;
736+
737+ lang_low:double | lang_high:double | category:keyword | gender:keyword
738+ 2.0 | 5.0 | .*?Accountant.*? | F
739+ 3.0 | 2.5 | .*?Accountant.*? | M
740+ 5.0 | 2.0 | .*?Accountant.*? | null
741+ 3.0 | 3.25 | .*?Architect.*? | F
742+ 3.75 | null | .*?Architect.*? | M
743+ ;
0 commit comments