Skip to content

Commit e716be1

Browse files
pquentinquux00
andauthored
Improve resolve/cluster yaml test (#121315) (#123261)
Updated indices.resolve_cluster.json to match new resolve/cluster spec. Added new test for the no-index-expression endpoint. Adjust syntax in 10_basic_resolve_cluster.yml syntax fix so that the elasticsearch-specification validation tests pass. (cherry picked from commit 3fafb5f) Co-authored-by: Michael Peterson <[email protected]>
1 parent a2f7486 commit e716be1

File tree

2 files changed

+63
-51
lines changed

2 files changed

+63
-51
lines changed
Lines changed: 40 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,56 @@
11
{
2-
"indices.resolve_cluster":{
3-
"documentation":{
4-
"url":"https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-resolve-cluster-api.html",
5-
"description":"Resolves the specified index expressions to return information about each cluster, including the local cluster, if included."
2+
"indices.resolve_cluster": {
3+
"documentation": {
4+
"url": "https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-resolve-cluster-api.html",
5+
"description": "Resolves the specified index expressions to return information about each cluster. If no index expression is provided, this endpoint will return information about all the remote clusters that are configured on the local cluster."
66
},
7-
"stability":"stable",
8-
"visibility":"public",
9-
"headers":{
10-
"accept": [ "application/json"]
7+
"stability": "stable",
8+
"visibility": "public",
9+
"headers": {
10+
"accept": ["application/json"]
1111
},
12-
"url":{
13-
"paths":[
12+
"url": {
13+
"paths": [
1414
{
15-
"path":"/_resolve/cluster/{name}",
16-
"methods":[
17-
"GET"
18-
],
19-
"parts":{
20-
"name":{
21-
"type":"list",
22-
"description":"A comma-separated list of cluster:index names or wildcard expressions"
15+
"path": "/_resolve/cluster",
16+
"methods": ["GET"]
17+
},
18+
{
19+
"path": "/_resolve/cluster/{name}",
20+
"methods": ["GET"],
21+
"parts": {
22+
"name": {
23+
"type": "list",
24+
"description": "A comma-separated list of cluster:index names or wildcard expressions"
2325
}
2426
}
2527
}
2628
]
2729
},
28-
"params":{
29-
"ignore_unavailable":{
30-
"type":"boolean",
31-
"description":"Whether specified concrete indices should be ignored when unavailable (missing or closed)"
30+
"params": {
31+
"ignore_unavailable": {
32+
"type": "boolean",
33+
"description": "Whether specified concrete indices should be ignored when unavailable (missing or closed). Only allowed when providing an index expression."
34+
},
35+
"ignore_throttled": {
36+
"type": "boolean",
37+
"description": "Whether specified concrete, expanded or aliased indices should be ignored when throttled. Only allowed when providing an index expression."
3238
},
33-
"ignore_throttled":{
34-
"type":"boolean",
35-
"description":"Whether specified concrete, expanded or aliased indices should be ignored when throttled"
39+
"allow_no_indices": {
40+
"type": "boolean",
41+
"description": "Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified). Only allowed when providing an index expression."
3642
},
37-
"allow_no_indices":{
38-
"type":"boolean",
39-
"description":"Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)"
43+
"expand_wildcards": {
44+
"type": "enum",
45+
"options": ["open", "closed", "hidden", "none", "all"],
46+
"default": "open",
47+
"description": "Whether wildcard expressions should get expanded to open or closed indices (default: open). Only allowed when providing an index expression."
4048
},
41-
"expand_wildcards":{
42-
"type":"enum",
43-
"options":[
44-
"open",
45-
"closed",
46-
"hidden",
47-
"none",
48-
"all"
49-
],
50-
"default":"open",
51-
"description":"Whether wildcard expressions should get expanded to open or closed indices (default: open)"
49+
"timeout": {
50+
"type": "time",
51+
"description": "The maximum time to wait for remote clusters to respond"
5252
}
5353
}
5454
}
5555
}
56+

rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.resolve_cluster/10_basic_resolve_cluster.yml

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ setup:
3939
- do:
4040
indices.resolve_cluster:
4141
name: '*'
42-
expand_wildcards: [closed]
42+
expand_wildcards: closed
4343

4444
- match: {(local).connected: true}
4545
- match: {(local).skip_unavailable: false}
@@ -65,7 +65,7 @@ setup:
6565
- do:
6666
indices.resolve_cluster:
6767
name: 'index2*'
68-
expand_wildcards: [open,closed]
68+
expand_wildcards: open,closed
6969

7070
- match: {(local).connected: true}
7171
- match: {(local).skip_unavailable: false}
@@ -75,7 +75,7 @@ setup:
7575
- do:
7676
indices.resolve_cluster:
7777
name: 'index2*'
78-
expand_wildcards: [closed]
78+
expand_wildcards: closed
7979

8080
- match: {(local).connected: true}
8181
- match: {(local).skip_unavailable: false}
@@ -115,7 +115,7 @@ setup:
115115
- do:
116116
indices.resolve_cluster:
117117
name: 'my_alias2,doesnotexist*'
118-
expand_wildcards: [all]
118+
expand_wildcards: all
119119

120120
- match: {(local).connected: true}
121121
- match: {(local).skip_unavailable: false}
@@ -141,10 +141,10 @@ setup:
141141
- do:
142142
indices.resolve_cluster:
143143
name: '*'
144-
expand_wildcards: [all]
145-
ignore_unavailable: [true]
146-
ignore_throttled: [true]
147-
allow_no_indices: [true]
144+
expand_wildcards: all
145+
ignore_unavailable: true
146+
ignore_throttled: true
147+
allow_no_indices: true
148148
allowed_warnings:
149149
- "[ignore_throttled] parameter is deprecated because frozen indices have been deprecated. Consider cold or frozen tiers in place of frozen indices."
150150

@@ -157,10 +157,10 @@ setup:
157157
- do:
158158
indices.resolve_cluster:
159159
name: '*'
160-
expand_wildcards: [open]
161-
ignore_unavailable: [false]
162-
ignore_throttled: [false]
163-
allow_no_indices: [false]
160+
expand_wildcards: open
161+
ignore_unavailable: false
162+
ignore_throttled: false
163+
allow_no_indices: false
164164
allowed_warnings:
165165
- "[ignore_throttled] parameter is deprecated because frozen indices have been deprecated. Consider cold or frozen tiers in place of frozen indices."
166166

@@ -170,3 +170,14 @@ setup:
170170
- is_false: (local).error # should not be present
171171
- exists: (local).version.number
172172

173+
---
174+
"Resolve cluster with no index expression":
175+
- requires:
176+
cluster_features: ["gte_v8.18.0"]
177+
reason: "resolve cluster with no index expression introduced in 8.18"
178+
179+
- do:
180+
indices.resolve_cluster:
181+
timeout: 400s
182+
183+
- is_false: (local).error # should not be present - body should be empty since no remotes configured

0 commit comments

Comments
 (0)