File: 20_filtering.yaml

package info (click to toggle)
elasticsearch 1.0.3%2Bdfsg-5
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 37,220 kB
  • sloc: java: 365,486; xml: 1,258; sh: 714; python: 505; ruby: 354; perl: 134; makefile: 41
file content (164 lines) | stat: -rw-r--r-- 3,616 bytes parent folder | download
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
setup:
  - do:
      index:
        index: testidx
        type:  testtype
        id:    testing_document
        body:
            "text" : "The quick brown fox is brown."
  - do:
      indices.refresh: {}

---
"Filtering the cluster state by blocks should return the blocks field even if the response is empty":
  - do:
      cluster.state:
        metric: [ blocks ]

  - is_true: blocks
  - is_false: nodes
  - is_false: metadata
  - is_false: routing_table
  - is_false: routing_nodes
  - is_false: allocations
  - length:   { blocks: 0 }

---
"Filtering the cluster state by blocks should return the blocks":
# read only index
# TODO: can this cause issues leaving it read only when deleting it in teardown
  - do:
      indices.put_settings:
        index: testidx
        body:
          index.blocks.read_only: true
  - do:
      cluster.state:
        metric: [ blocks ]

  - is_true: blocks
  - is_false: nodes
  - is_false: metadata
  - is_false: routing_table
  - is_false: routing_nodes
  - is_false: allocations
  - length:   { blocks: 1 }

---
"Filtering the cluster state by nodes only should work":
  - do:
      cluster.state:
        metric: [ nodes ]

  - is_false: blocks
  - is_true: nodes
  - is_false: metadata
  - is_false: routing_table
  - is_false: routing_nodes
  - is_false: allocations

---
"Filtering the cluster state by metadata only should work":
  - do:
      cluster.state:
        metric: [ metadata ]

  - is_false: blocks
  - is_false: nodes
  - is_true: metadata
  - is_false: routing_table
  - is_false: routing_nodes
  - is_false: allocations


---
"Filtering the cluster state by routing table only should work":
  - do:
      cluster.state:
        metric: [ routing_table ]

  - is_false: blocks
  - is_false: nodes
  - is_false: metadata
  - is_true: routing_table
  - is_true: routing_nodes
  - is_true: allocations


---
"Filtering the cluster state for specific index templates should work ":
  - do:
      indices.put_template:
        name: test1
        body:
          template: test-*
          settings:
            number_of_shards:   1

  - do:
      indices.put_template:
        name: test2
        body:
          template: test-*
          settings:
            number_of_shards:   2

  - do:
      indices.put_template:
        name: foo
        body:
          template: foo-*
          settings:
            number_of_shards:   3
  - do:
      cluster.state:
        metric: [ metadata ]
        index_templates: [ test1, test2 ]

  - is_false: blocks
  - is_false: nodes
  - is_true: metadata
  - is_false: routing_table
  - is_false: routing_nodes
  - is_false: allocations
  - is_true: metadata.templates.test1
  - is_true: metadata.templates.test2
  - is_false: metadata.templates.foo

---
"Filtering the cluster state by indices should work in routing table and metadata":
  - do:
      index:
        index: another
        type:  type
        id:    testing_document
        body:
            "text" : "The quick brown fox is brown."

  - do:
      indices.refresh: {}

  - do:
      cluster.state:
        metric: [ routing_table, metadata ]
        index: [ testidx ]

  - is_false: metadata.indices.another
  - is_false: routing_table.indices.another
  - is_true: metadata.indices.testidx
  - is_true: routing_table.indices.testidx

---
"Filtering the cluster state using _all for indices and metrics should work":
  - do:
      cluster.state:
        metric: [ '_all' ]
        index: [ '_all' ]

  - is_true: blocks
  - is_true: nodes
  - is_true: metadata
  - is_true: routing_table
  - is_true: routing_nodes
  - is_true: allocations