File tree 1 file changed +88
-0
lines changed
1 file changed +88
-0
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ requires :
3
+ serverless : true
4
+ stack : true
5
+ ---
6
+ setup :
7
+ - do :
8
+ query_rules.put_ruleset :
9
+ ruleset_id : test-ruleset
10
+ body :
11
+ rules :
12
+ - rule_id : rule1
13
+ type : pinned
14
+ criteria :
15
+ - type : exact
16
+ metadata : query_string
17
+ values : [ search ]
18
+ actions :
19
+ ids :
20
+ - ' doc1'
21
+ - rule_id : rule2
22
+ type : pinned
23
+ criteria :
24
+ - type : exact
25
+ metadata : query_string
26
+ values : [ ui ]
27
+ actions :
28
+ docs :
29
+ - ' _index ' : ' test-index1'
30
+ ' _id ' : ' doc2'
31
+ - rule_id : rule3
32
+ type : pinned
33
+ criteria :
34
+ - type : contains
35
+ metadata : query_string
36
+ values : [ kibana, logstash ]
37
+ actions :
38
+ ids :
39
+ - ' doc2'
40
+ - ' doc3'
41
+ - rule_id : rule4
42
+ type : pinned
43
+ criteria :
44
+ - type : exact
45
+ metadata : query_string
46
+ values : [ ops ]
47
+ actions :
48
+ ids :
49
+ - ' doc7'
50
+ - rule_id : rule5
51
+ type : exclude
52
+ criteria :
53
+ - type : exact
54
+ metadata : query_string
55
+ values : [ search ]
56
+ actions :
57
+ ids :
58
+ - ' doc8'
59
+ ---
60
+ teardown :
61
+ - do :
62
+ query_rules.delete_ruleset :
63
+ ruleset_id : test-ruleset
64
+ ignore : 404
65
+ ---
66
+ " Test query rules " :
67
+ - do :
68
+ catch : /resource_not_found_exception/
69
+ query_rules.test :
70
+ ruleset_id : nonexistent-ruleset
71
+ body :
72
+ match_criteria :
73
+ foo : bar
74
+ - do :
75
+ catch : bad_request
76
+ query_rules.test :
77
+ ruleset_id : nonexistent-ruleset
78
+ body : { }
79
+ - do :
80
+ query_rules.test :
81
+ ruleset_id : test-ruleset
82
+ body :
83
+ match_criteria :
84
+ query_string : search
85
+
86
+ - match : { total_matched_rules: 2 }
87
+ - match : { matched_rules.0.rule_id: 'rule1' }
88
+ - match : { matched_rules.1.rule_id: 'rule5' }
You can’t perform that action at this time.
0 commit comments