-
Notifications
You must be signed in to change notification settings - Fork 24.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adapt the Cluster Health and Cat Indices APIs to closed indices #39364
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,12 @@ | |
} | ||
}, | ||
"params": { | ||
"expand_wildcards": { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think expand_wildcards should be added to _cat/indices too for symmetry and to be able to drill down into cluster health status using same expand_wildcards and index parameters? |
||
"type" : "enum", | ||
"options" : ["open","closed","none","all"], | ||
"default" : "all", | ||
"description" : "Whether to expand wildcard expression to concrete indices that are open, closed or both." | ||
}, | ||
"level": { | ||
"type" : "enum", | ||
"options" : ["cluster","indices","shards"], | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -132,4 +132,150 @@ | |
- is_true: indices | ||
- is_true: indices.test_index.shards | ||
|
||
--- | ||
"cluster health with closed index (pre 8.0)": | ||
- skip: | ||
version: "8.0.0 - " | ||
reason: "closed indices are replicated starting version 8.0" | ||
|
||
- do: | ||
indices.create: | ||
index: index-1 | ||
body: | ||
settings: | ||
index: | ||
number_of_replicas: 0 | ||
|
||
- do: | ||
cluster.health: | ||
wait_for_status: green | ||
- match: { status: green } | ||
|
||
- do: | ||
indices.create: | ||
index: index-2 | ||
body: | ||
settings: | ||
index: | ||
number_of_replicas: 50 | ||
|
||
- do: | ||
cluster.health: | ||
wait_for_status: yellow | ||
wait_for_no_relocating_shards: true | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also wait_for_no_initializing-shards? Seems we do so in ClusterHealthIT, so thought this should be the same? |
||
- match: { status: yellow } | ||
|
||
- do: | ||
cluster.health: | ||
index: index-* | ||
- match: { status: yellow } | ||
|
||
- do: | ||
cluster.health: | ||
index: index-1 | ||
- match: { status: green } | ||
|
||
- do: | ||
cluster.health: | ||
index: index-2 | ||
- match: { status: yellow } | ||
|
||
- do: | ||
indices.close: | ||
index: index-2 | ||
- is_true: acknowledged | ||
|
||
# closing the index-2 turns the cluster health back to green | ||
- do: | ||
cluster.health: | ||
wait_for_status: green | ||
- match: { status: green } | ||
|
||
- do: | ||
cluster.health: | ||
index: index-* | ||
- match: { status: green } | ||
|
||
- do: | ||
cluster.health: | ||
index: index-1 | ||
- match: { status: green } | ||
|
||
- do: | ||
cluster.health: | ||
index: index-2 | ||
- match: { status: green } | ||
|
||
--- | ||
"cluster health with closed index": | ||
- skip: | ||
version: " - 7.99.99" | ||
reason: "closed indices are replicated starting version 8.0" | ||
|
||
- do: | ||
indices.create: | ||
index: index-1 | ||
body: | ||
settings: | ||
index: | ||
number_of_replicas: 0 | ||
|
||
- do: | ||
cluster.health: | ||
wait_for_status: green | ||
- match: { status: green } | ||
|
||
- do: | ||
indices.create: | ||
index: index-2 | ||
body: | ||
settings: | ||
index: | ||
number_of_replicas: 50 | ||
|
||
- do: | ||
cluster.health: | ||
wait_for_status: yellow | ||
wait_for_no_relocating_shards: true | ||
- match: { status: yellow } | ||
|
||
- do: | ||
cluster.health: | ||
index: index-* | ||
- match: { status: yellow } | ||
|
||
- do: | ||
cluster.health: | ||
index: index-1 | ||
- match: { status: green } | ||
|
||
- do: | ||
cluster.health: | ||
index: index-2 | ||
- match: { status: yellow } | ||
|
||
# closing the index-2 does not change the cluster health with replicated closed indices | ||
- do: | ||
indices.close: | ||
index: index-2 | ||
- is_true: acknowledged | ||
|
||
- do: | ||
cluster.health: | ||
wait_for_status: yellow | ||
- match: { status: yellow } | ||
|
||
- do: | ||
cluster.health: | ||
index: index-* | ||
- match: { status: yellow } | ||
|
||
- do: | ||
cluster.health: | ||
index: index-1 | ||
- match: { status: green } | ||
|
||
- do: | ||
cluster.health: | ||
index: index-2 | ||
- match: { status: yellow } |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
setup: | ||
|
||
- do: | ||
indices.create: | ||
index: index-1 | ||
body: | ||
settings: | ||
number_of_shards: 1 | ||
number_of_replicas: 0 | ||
|
||
- do: | ||
indices.create: | ||
index: index-2 | ||
body: | ||
settings: | ||
number_of_shards: 2 | ||
number_of_replicas: 0 | ||
|
||
- do: | ||
cluster.health: | ||
wait_for_status: green | ||
|
||
- do: | ||
indices.close: | ||
index: index-2 | ||
|
||
- do: | ||
cluster.health: | ||
wait_for_status: green | ||
|
||
--- | ||
"cluster health with expand_wildcards": | ||
- skip: | ||
version: " - 7.99.99" | ||
reason: "indices options has been introduced in cluster health request starting version 8.0" | ||
|
||
- do: | ||
cluster.health: | ||
index: "index-*" | ||
level: indices | ||
expand_wildcards: open | ||
- match: { status: green } | ||
- match: { active_shards: 1 } | ||
- match: { indices.index-1.status: green } | ||
- match: { indices.index-1.active_shards: 1 } | ||
- is_false: indices.index-2 | ||
|
||
- do: | ||
cluster.health: | ||
index: "index-*" | ||
level: indices | ||
expand_wildcards: closed | ||
- match: { status: green } | ||
- match: { active_shards: 2 } | ||
- is_false: indices.index-1 | ||
- match: { indices.index-2.status: green } | ||
- match: { indices.index-2.active_shards: 2 } | ||
|
||
- do: | ||
cluster.health: | ||
index: "index-*" | ||
level: indices | ||
expand_wildcards: all | ||
- match: { status: green } | ||
- match: { active_shards: 3 } | ||
- match: { indices.index-1.status: green } | ||
- match: { indices.index-1.active_shards: 1 } | ||
- match: { indices.index-2.status: green } | ||
- match: { indices.index-2.active_shards: 2 } | ||
|
||
- do: | ||
cluster.health: | ||
index: "index-*" | ||
level: indices | ||
expand_wildcards: none | ||
- match: { status: green } | ||
- match: { active_shards: 0 } | ||
- is_false: indices.index-1 | ||
- is_false: indices.index-2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The REST API supports other indices options like
ignore_unavailable
but those options are overridden in theTransportClusterHealthAction
to report a RED status is an index is missing (or just ignore it).This is why this sole option is documented.