Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,47 +5,119 @@
cluster.allocation_explain: {}

---
"cluster shard allocation explanation test":
"cluster shard allocation explanation test with empty request":
- do:
indices.create:
index: test
body: { "settings": { "index.number_of_shards": 1, "index.number_of_replicas": 9 } }

- do:
cluster.allocation_explain:
include_disk_info: true

- match: { current_state: "unassigned" }
- match: { unassigned_info.reason: "INDEX_CREATED" }
- is_true: unassigned_info.at
- match: { index: "test" }
- match: { shard: 0 }
- match: { primary: false }
- is_true: cluster_info
- is_true: can_allocate

---
# This test has a valid integer input, but it's above the shard limit, so the index cannot be located
"cluster shard allocation explanation test with max integer shard value":
- do:
indices.create:
index: test

- match: { acknowledged: true }

- do:
catch: /shard_not_found_exception/
cluster.allocation_explain:
body: { "index": "test", "shard": 0, "primary": true }
body: { "index": "test", "shard": 2147483647, "primary": true }

---
"cluster shard allocation explanation test with long shard value":
- do:
indices.create:
index: test

- match: { acknowledged: true }

- do:
catch: /x_content_parse_exception/
cluster.allocation_explain:
body: { "index": "test", "shard": 214748364777, "primary": true }

---
"cluster shard allocation explanation test with float shard value":
- do:
indices.create:
index: test
body: { "settings": { "index.number_of_shards": 2, "index.number_of_replicas": 0 } }

- match: { acknowledged: true }

- do:
cluster.allocation_explain:
body: { "index": "test", "shard": 1.0, "primary": true }

- match: { current_state: "started" }
- is_true: current_node.id
- match: { index: "test" }
- match: { shard: 0 }
- match: { shard: 1 }
- match: { primary: true }
- is_true: can_remain_on_current_node
- is_true: can_rebalance_cluster
- is_true: can_rebalance_to_other_node
- is_true: rebalance_explanation

---
"cluster shard allocation explanation test with empty request":
"cluster shard allocation explanation test with double shard value":
- do:
indices.create:
index: test
body: { "settings": { "index.number_of_shards": 1, "index.number_of_replicas": 9 } }
body: { "settings": { "index.number_of_shards": 2, "index.number_of_replicas": 0 } }

- match: { acknowledged: true }

- do:
cluster.allocation_explain:
include_disk_info: true
body: { "index": "test", "shard": 1.1234567891234567, "primary": true }

- match: { current_state: "unassigned" }
- match: { unassigned_info.reason: "INDEX_CREATED" }
- is_true: unassigned_info.at
- match: { current_state: "started" }
- is_true: current_node.id
- match: { index: "test" }
- match: { shard: 0 }
- match: { primary: false }
- is_true: cluster_info
- is_true: can_allocate
- match: { shard: 1 }
- match: { primary: true }
- is_true: can_remain_on_current_node
- is_true: can_rebalance_cluster
- is_true: can_rebalance_to_other_node
- is_true: rebalance_explanation

---
"cluster shard allocation explanation test with three valid body parameters":
- do:
indices.create:
index: test

- match: { acknowledged: true }

- do:
cluster.allocation_explain:
body: { "index": "test", "shard": 0, "primary": true }

- match: { current_state: "started" }
- is_true: current_node.id
- match: { index: "test" }
- match: { shard: 0 }
- match: { primary: true }
- is_true: can_remain_on_current_node
- is_true: can_rebalance_cluster
- is_true: can_rebalance_to_other_node
- is_true: rebalance_explanation

---
"Cluster shard allocation explanation test with a closed index":
Expand Down