-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Gao Binlong <gbinlong@amazon.com>
- Loading branch information
1 parent
88a5528
commit 2bad9ff
Showing
2 changed files
with
82 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
rest-api-spec/src/main/resources/rest-api-spec/test/indices.shrink/40_max_shard_size.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
--- | ||
"Shrink index with max_shard_size": | ||
# shrink index with max_shard_size parameter, which is used to generate an optimum | ||
# number_of_shards for the target index. | ||
|
||
- skip: | ||
version: " - 2.9.99" | ||
reason: "only available in 3.0+" | ||
features: allowed_warnings | ||
|
||
- do: | ||
nodes.info: | ||
node_id: data:true | ||
- set: | ||
nodes._arbitrary_key_: node_id | ||
|
||
- do: | ||
indices.create: | ||
index: source | ||
wait_for_active_shards: 1 | ||
body: | ||
settings: | ||
# ensure everything is allocated on the same data node | ||
index.routing.allocation.include._id: $node_id | ||
index.number_of_shards: 3 | ||
index.number_of_replicas: 0 | ||
- do: | ||
index: | ||
index: source | ||
id: "1" | ||
body: { "foo": "hello world" } | ||
|
||
- do: | ||
get: | ||
index: source | ||
id: "1" | ||
|
||
- match: { _index: source } | ||
- match: { _id: "1" } | ||
- match: { _source: { foo: "hello world" } } | ||
|
||
# make it read-only | ||
- do: | ||
indices.put_settings: | ||
index: source | ||
body: | ||
index.blocks.write: true | ||
index.number_of_replicas: 0 | ||
|
||
- do: | ||
cluster.health: | ||
wait_for_status: green | ||
index: source | ||
|
||
# shrink with max_shard_size | ||
- do: | ||
allowed_warnings: | ||
- "Parameter [master_timeout] is deprecated and will be removed in 3.0. To support inclusive language, please use [cluster_manager_timeout] instead." | ||
indices.shrink: | ||
index: "source" | ||
target: "new_shrunken_index" | ||
wait_for_active_shards: 1 | ||
master_timeout: 10s | ||
body: | ||
settings: | ||
index.number_of_replicas: 0 | ||
max_shard_size: "10gb" | ||
|
||
- do: | ||
cluster.health: | ||
wait_for_status: green | ||
|
||
- do: | ||
get: | ||
index: "new_shrunken_index" | ||
id: "1" | ||
|
||
- do: | ||
indices.get_settings: | ||
index: "new_shrunken_index" | ||
|
||
- match: { new_shrunken_index.settings.index.number_of_shards: "1" } |