Skip to content
Merged
Show file tree
Hide file tree
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 @@ -642,7 +642,12 @@ public void testShrink() throws IOException {

ResizeRequest resizeRequest = new ResizeRequest("target", "source");
resizeRequest.setResizeType(ResizeType.SHRINK);
Settings targetSettings = Settings.builder().put("index.number_of_shards", 2).put("index.number_of_replicas", 0).build();
Settings targetSettings =
Settings.builder()
.put("index.number_of_shards", 2)
.put("index.number_of_replicas", 0)
.putNull("index.routing.allocation.require._name")
.build();
resizeRequest.setTargetIndex(new CreateIndexRequest("target").settings(targetSettings).alias(new Alias("alias")));
ResizeResponse resizeResponse = highLevelClient().indices().shrink(resizeRequest);
assertTrue(resizeResponse.isAcknowledged());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1305,7 +1305,8 @@ public void testShrinkIndex() throws Exception {
// end::shrink-index-request-waitForActiveShards
// tag::shrink-index-request-settings
request.getTargetIndexRequest().settings(Settings.builder()
.put("index.number_of_shards", 2)); // <1>
.put("index.number_of_shards", 2) // <1>
.putNull("index.routing.allocation.require._name")); // <2>
// end::shrink-index-request-settings
// tag::shrink-index-request-aliases
request.getTargetIndexRequest().alias(new Alias("target_alias")); // <1>
Expand Down
4 changes: 2 additions & 2 deletions docs/java-rest/high-level/indices/shrink_index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ returns a response, as an `ActiveShardCount`
--------------------------------------------------
include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[shrink-index-request-settings]
--------------------------------------------------
<1> The settings to apply to the target index, which include the number of
shards to create for it
<1> The number of shards on the target of the shrink index request
<2> Remove the allocation requirement copied from the source index

["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
Expand Down
14 changes: 2 additions & 12 deletions docs/reference/indices/shrink-index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ the following request:

[source,js]
--------------------------------------------------
POST my_source_index/_shrink/my_target_index?copy_settings=true
POST my_source_index/_shrink/my_target_index
{
"settings": {
"index.routing.allocation.require._name": null, <1>
Expand Down Expand Up @@ -106,7 +106,7 @@ and accepts `settings` and `aliases` parameters for the target index:

[source,js]
--------------------------------------------------
POST my_source_index/_shrink/my_target_index?copy_settings=true
POST my_source_index/_shrink/my_target_index
{
"settings": {
"index.number_of_replicas": 1,
Expand All @@ -130,16 +130,6 @@ POST my_source_index/_shrink/my_target_index?copy_settings=true

NOTE: Mappings may not be specified in the `_shrink` request.

NOTE: By default, with the exception of `index.analysis`, `index.similarity`,
and `index.sort` settings, index settings on the source index are not copied
during a shrink operation. With the exception of non-copyable settings, settings
from the source index can be copied to the target index by adding the URL
parameter `copy_settings=true` to the request. Note that `copy_settings` can not
be set to `false`. The parameter `copy_settings` will be removed in 8.0.0

deprecated[6.4.0, not copying settings is deprecated, copying settings will be
the default behavior in 7.x]

[float]
=== Monitoring the shrink process

Expand Down
14 changes: 2 additions & 12 deletions docs/reference/indices/split-index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ the following request:

[source,js]
--------------------------------------------------
POST my_source_index/_split/my_target_index?copy_settings=true
POST my_source_index/_split/my_target_index
{
"settings": {
"index.number_of_shards": 2
Expand Down Expand Up @@ -158,7 +158,7 @@ and accepts `settings` and `aliases` parameters for the target index:

[source,js]
--------------------------------------------------
POST my_source_index/_split/my_target_index?copy_settings=true
POST my_source_index/_split/my_target_index
{
"settings": {
"index.number_of_shards": 5 <1>
Expand All @@ -177,16 +177,6 @@ POST my_source_index/_split/my_target_index?copy_settings=true

NOTE: Mappings may not be specified in the `_split` request.

NOTE: By default, with the exception of `index.analysis`, `index.similarity`,
and `index.sort` settings, index settings on the source index are not copied
during a split operation. With the exception of non-copyable settings, settings
from the source index can be copied to the target index by adding the URL
parameter `copy_settings=true` to the request. Note that `copy_settings` can not
be set to `false`. The parameter `copy_settings` will be removed in 8.0.0

deprecated[6.4.0, not copying settings is deprecated, copying settings will be
the default behavior in 7.x]

[float]
=== Monitoring the split process

Expand Down
10 changes: 10 additions & 0 deletions docs/reference/migration/migrate_7_0/api.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,13 @@ deprecated in 6.3.0 and now removed in 7.0.0.
In the past, `fields` could be provided either as a parameter, or as part of the request
body. Specifying `fields` in the request body as opposed to a parameter was deprecated
in 6.4.0, and is now unsupported in 7.0.0.

==== `copy_settings` is deprecated on shrink and split APIs

Versions of Elasticsearch prior to 6.4.0 did not copy index settings on shrink
and split operations. Starting with Elasticsearch 7.0.0, the default behavior
will be for such settings to be copied on such operations. To enable users in
6.4.0 to transition in 6.4.0 to the default behavior in 7.0.0, the
`copy_settings` parameter was added on the REST layer. As this behavior will be
the only behavior in 8.0.0, this parameter is deprecated in 7.0.0 for removal in
8.0.0.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
"Shrink index via API":
- skip:
version: " - 6.3.99"
reason: expects warnings that pre-6.4.0 will not send
version: " - 6.9.99"
reason: expects warnings that pre-7.0.0 will not send
features: "warnings"
# creates an index with one document solely allocated on the master node
# and shrinks it into a new index with a single shard
Expand Down Expand Up @@ -67,8 +67,6 @@
body:
settings:
index.number_of_replicas: 0
warnings:
- "resize operations without copying settings is deprecated; set parameter [copy_settings] to [true] for future default behavior"

- do:
cluster.health:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
"Shrink index ignores target template mapping":
- skip:
version: " - 6.3.99"
reason: expects warnings that pre-6.4.0 will not send
version: " - 6.9.99"
reason: expects warnings that pre-7.0.0 will not send
features: "warnings"

- do:
Expand Down Expand Up @@ -71,8 +71,6 @@
body:
settings:
index.number_of_replicas: 0
warnings:
- "resize operations without copying settings is deprecated; set parameter [copy_settings] to [true] for future default behavior"

- do:
cluster.health:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
"Copy settings during shrink index":
- skip:
version: " - 6.3.99"
reason: expects warnings that pre-6.4.0 will not send
version: " - 6.9.99"
reason: expects warnings that pre-7.0.0 will not send
features: "warnings"

- do:
Expand Down Expand Up @@ -48,6 +48,8 @@
settings:
index.number_of_replicas: 0
index.merge.scheduler.max_thread_count: 2
warnings:
- "parameter [copy_settings] is deprecated and will be removed in 8.0.0"

- do:
cluster.health:
Expand All @@ -63,33 +65,31 @@
- match: { copy-settings-target.settings.index.blocks.write: "true" }
- match: { copy-settings-target.settings.index.routing.allocation.include._id: $master }

# now we do a actual shrink and do not copy settings (by default)
# now we do a actual shrink and copy settings (by default)
- do:
indices.shrink:
index: "source"
target: "no-copy-settings-target"
target: "default-copy-settings-target"
wait_for_active_shards: 1
master_timeout: 10s
body:
settings:
index.number_of_replicas: 0
index.merge.scheduler.max_thread_count: 2
warnings:
- "resize operations without copying settings is deprecated; set parameter [copy_settings] to [true] for future default behavior"

- do:
cluster.health:
wait_for_status: green

- do:
indices.get_settings:
index: "no-copy-settings-target"
index: "default-copy-settings-target"

# only the request setting should be copied
- is_false: no-copy-settings-target.settings.index.merge.scheduler.max_merge_count
- match: { no-copy-settings-target.settings.index.merge.scheduler.max_thread_count: "2" }
- is_false: no-copy-settings-target.settings.index.blocks.write
- is_false: no-copy-settings-target.settings.index.routing.allocation.include._id
# settings should be copied
- match: { default-copy-settings-target.settings.index.merge.scheduler.max_merge_count: "4" }
- match: { default-copy-settings-target.settings.index.merge.scheduler.max_thread_count: "2" }
- match: { default-copy-settings-target.settings.index.blocks.write: "true" }
- match: { default-copy-settings-target.settings.index.routing.allocation.include._id: $master }

# now we do a actual shrink and try to set no copy settings
- do:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ setup:
---
"Split index via API":
- skip:
version: " - 6.3.99"
reason: expects warnings that pre-6.4.0 will not send
version: " - 6.9.99"
reason: pre-7.0.0 will send warnings
features: "warnings"

# make it read-only
Expand All @@ -61,8 +61,6 @@ setup:
settings:
index.number_of_replicas: 0
index.number_of_shards: 4
warnings:
- "resize operations without copying settings is deprecated; set parameter [copy_settings] to [true] for future default behavior"

- do:
cluster.health:
Expand Down Expand Up @@ -108,8 +106,7 @@ setup:
"Split from 1 to N":
- skip:
version: " - 6.99.99"
reason: Automatic preparation for splitting was added in 7.0.0
features: "warnings"
reason: automatic preparation for splitting was added in 7.0.0
- do:
indices.create:
index: source_one_shard
Expand Down Expand Up @@ -163,8 +160,6 @@ setup:
settings:
index.number_of_replicas: 0
index.number_of_shards: 5
warnings:
- "resize operations without copying settings is deprecated; set parameter [copy_settings] to [true] for future default behavior"

- do:
cluster.health:
Expand Down Expand Up @@ -205,13 +200,11 @@ setup:
- match: { _id: "3" }
- match: { _source: { foo: "hello world 3" } }



---
"Create illegal split indices":
- skip:
version: " - 6.3.99"
reason: expects warnings that pre-6.4.0 will not send
version: " - 6.9.99"
reason: pre-7.0.0 will send warnings
features: "warnings"

# try to do an illegal split with number_of_routing_shards set
Expand All @@ -227,8 +220,6 @@ setup:
index.number_of_replicas: 0
index.number_of_shards: 4
index.number_of_routing_shards: 8
warnings:
- "resize operations without copying settings is deprecated; set parameter [copy_settings] to [true] for future default behavior"

# try to do an illegal split with illegal number_of_shards
- do:
Expand All @@ -242,5 +233,3 @@ setup:
settings:
index.number_of_replicas: 0
index.number_of_shards: 6
warnings:
- "resize operations without copying settings is deprecated; set parameter [copy_settings] to [true] for future default behavior"
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
"Split index ignores target template mapping":
- skip:
version: " - 6.3.99"
reason: expects warnings that pre-6.4.0 will not send
version: " - 6.9.99"
reason: pre-7.0.0 will send warnings
features: "warnings"

# create index
Expand Down Expand Up @@ -65,8 +65,6 @@
settings:
index.number_of_shards: 2
index.number_of_replicas: 0
warnings:
- "resize operations without copying settings is deprecated; set parameter [copy_settings] to [true] for future default behavior"

- do:
cluster.health:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
"Copy settings during split index":
- skip:
version: " - 6.3.99"
reason: expects warnings that pre-6.4.0 will not send
version: " - 6.9.99"
reason: expects warnings that pre-7.0.0 will not send
features: "warnings"

- do:
Expand Down Expand Up @@ -50,6 +50,9 @@
index.number_of_replicas: 0
index.number_of_shards: 2
index.merge.scheduler.max_thread_count: 2
warnings:
- "parameter [copy_settings] is deprecated and will be removed in 8.0.0"


- do:
cluster.health:
Expand All @@ -65,34 +68,32 @@
- match: { copy-settings-target.settings.index.blocks.write: "true" }
- match: { copy-settings-target.settings.index.routing.allocation.include._id: $master }

# now we do a actual shrink and do not copy settings (by default)
# now we do a actual shrink and copy settings (by default)
- do:
indices.split:
index: "source"
target: "no-copy-settings-target"
target: "default-copy-settings-target"
wait_for_active_shards: 1
master_timeout: 10s
body:
settings:
index.number_of_replicas: 0
index.number_of_shards: 2
index.merge.scheduler.max_thread_count: 2
warnings:
- "resize operations without copying settings is deprecated; set parameter [copy_settings] to [true] for future default behavior"

- do:
cluster.health:
wait_for_status: green

- do:
indices.get_settings:
index: "no-copy-settings-target"
index: "default-copy-settings-target"

# only the request setting should be copied
- is_false: no-copy-settings-target.settings.index.merge.scheduler.max_merge_count
- match: { no-copy-settings-target.settings.index.merge.scheduler.max_thread_count: "2" }
- is_false: no-copy-settings-target.settings.index.blocks.write
- is_false: no-copy-settings-target.settings.index.routing.allocation.include._id
# settings should be copied
- match: { default-copy-settings-target.settings.index.merge.scheduler.max_merge_count: "4" }
- match: { default-copy-settings-target.settings.index.merge.scheduler.max_thread_count: "2" }
- match: { default-copy-settings-target.settings.index.blocks.write: "true" }
- match: { default-copy-settings-target.settings.index.routing.allocation.include._id: $master }

- do:
catch: /illegal_argument_exception/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public class ResizeRequest extends AcknowledgedRequest<ResizeRequest> implements
private CreateIndexRequest targetIndexRequest;
private String sourceIndex;
private ResizeType type = ResizeType.SHRINK;
private Boolean copySettings;
private Boolean copySettings = true;

ResizeRequest() {}

Expand Down
Loading