-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path30_test.yml
88 lines (87 loc) · 2.19 KB
/
30_test.yml
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
---
requires:
serverless: true
stack: true
---
setup:
- do:
query_rules.put_ruleset:
ruleset_id: test-ruleset
body:
rules:
- rule_id: rule1
type: pinned
criteria:
- type: exact
metadata: query_string
values: [ search ]
actions:
ids:
- 'doc1'
- rule_id: rule2
type: pinned
criteria:
- type: exact
metadata: query_string
values: [ ui ]
actions:
docs:
- '_index': 'test-index1'
'_id': 'doc2'
- rule_id: rule3
type: pinned
criteria:
- type: contains
metadata: query_string
values: [ kibana, logstash ]
actions:
ids:
- 'doc2'
- 'doc3'
- rule_id: rule4
type: pinned
criteria:
- type: exact
metadata: query_string
values: [ ops ]
actions:
ids:
- 'doc7'
- rule_id: rule5
type: exclude
criteria:
- type: exact
metadata: query_string
values: [ search ]
actions:
ids:
- 'doc8'
---
teardown:
- do:
query_rules.delete_ruleset:
ruleset_id: test-ruleset
ignore: 404
---
"Test query rules":
- do:
catch: /resource_not_found_exception/
query_rules.test:
ruleset_id: nonexistent-ruleset
body:
match_criteria:
foo: bar
- do:
catch: bad_request
query_rules.test:
ruleset_id: nonexistent-ruleset
body: { }
- do:
query_rules.test:
ruleset_id: test-ruleset
body:
match_criteria:
query_string: search
- match: { total_matched_rules: 2 }
- match: { matched_rules.0.rule_id: 'rule1' }
- match: { matched_rules.1.rule_id: 'rule5' }