Skip to content

Commit 4371e36

Browse files
authored
Improve resolve/cluster yaml test (elastic#121315) (elastic#121420)
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.
1 parent 1bbd669 commit 4371e36

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
@@ -41,7 +41,7 @@ setup:
4141
- do:
4242
indices.resolve_cluster:
4343
name: '*'
44-
expand_wildcards: [closed]
44+
expand_wildcards: closed
4545

4646
- match: {(local).connected: true}
4747
- match: {(local).skip_unavailable: false}
@@ -67,7 +67,7 @@ setup:
6767
- do:
6868
indices.resolve_cluster:
6969
name: 'index2*'
70-
expand_wildcards: [open,closed]
70+
expand_wildcards: open,closed
7171

7272
- match: {(local).connected: true}
7373
- match: {(local).skip_unavailable: false}
@@ -77,7 +77,7 @@ setup:
7777
- do:
7878
indices.resolve_cluster:
7979
name: 'index2*'
80-
expand_wildcards: [closed]
80+
expand_wildcards: closed
8181

8282
- match: {(local).connected: true}
8383
- match: {(local).skip_unavailable: false}
@@ -117,7 +117,7 @@ setup:
117117
- do:
118118
indices.resolve_cluster:
119119
name: 'my_alias2,doesnotexist*'
120-
expand_wildcards: [all]
120+
expand_wildcards: all
121121

122122
- match: {(local).connected: true}
123123
- match: {(local).skip_unavailable: false}
@@ -143,10 +143,10 @@ setup:
143143
- do:
144144
indices.resolve_cluster:
145145
name: '*'
146-
expand_wildcards: [all]
147-
ignore_unavailable: [true]
148-
ignore_throttled: [true]
149-
allow_no_indices: [true]
146+
expand_wildcards: all
147+
ignore_unavailable: true
148+
ignore_throttled: true
149+
allow_no_indices: true
150150
allowed_warnings:
151151
- "[ignore_throttled] parameter is deprecated because frozen indices have been deprecated. Consider cold or frozen tiers in place of frozen indices."
152152

@@ -159,10 +159,10 @@ setup:
159159
- do:
160160
indices.resolve_cluster:
161161
name: '*'
162-
expand_wildcards: [open]
163-
ignore_unavailable: [false]
164-
ignore_throttled: [false]
165-
allow_no_indices: [false]
162+
expand_wildcards: open
163+
ignore_unavailable: false
164+
ignore_throttled: false
165+
allow_no_indices: false
166166
allowed_warnings:
167167
- "[ignore_throttled] parameter is deprecated because frozen indices have been deprecated. Consider cold or frozen tiers in place of frozen indices."
168168

@@ -172,3 +172,14 @@ setup:
172172
- is_false: (local).error # should not be present
173173
- exists: (local).version.number
174174

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

0 commit comments

Comments
 (0)