Skip to content

Commit 7ca37d3

Browse files
authored
Remove @UpdateForV9 annotation from ReindexRequest#failOnSizeSpecified (#122729) (#122798)
The size parameter hasn't been accepted since 8.0, end users should use max_docs and if the user specify it, we can defer to the standard error message produced by the parser.
1 parent 7304580 commit 7ca37d3

File tree

3 files changed

+5
-12
lines changed

3 files changed

+5
-12
lines changed

modules/reindex/build.gradle

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,3 +167,7 @@ if (OS.current() == OS.WINDOWS) {
167167
}
168168
}
169169
}
170+
171+
tasks.named("yamlRestCompatTestTransform").configure { task ->
172+
task.skipTest("reindex/20_validation/specifying size fails", "size is rejected in 9.0")
173+
}

modules/reindex/src/yamlRestTest/resources/rest-api-spec/test/reindex/20_validation.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@
107107
body: { "text": "test" }
108108

109109
- do:
110-
catch: /invalid parameter \[size\], use \[max_docs\] instead/
110+
catch: /(invalid parameter \[size\], use \[max_docs\] instead|unknown field \[size\])/
111111
reindex:
112112
body:
113113
source:

server/src/main/java/org/elasticsearch/index/reindex/ReindexRequest.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import org.elasticsearch.common.settings.SecureString;
2222
import org.elasticsearch.common.xcontent.XContentHelper;
2323
import org.elasticsearch.core.TimeValue;
24-
import org.elasticsearch.core.UpdateForV9;
2524
import org.elasticsearch.features.NodeFeature;
2625
import org.elasticsearch.index.VersionType;
2726
import org.elasticsearch.index.query.QueryBuilder;
@@ -355,10 +354,6 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
355354
);
356355

357356
PARSER.declareInt(ReindexRequest::setMaxDocsValidateIdentical, new ParseField("max_docs"));
358-
359-
// avoid silently accepting an ignored size.
360-
PARSER.declareInt((r, s) -> failOnSizeSpecified(), new ParseField("size"));
361-
362357
PARSER.declareField((p, v, c) -> v.setScript(Script.parse(p)), new ParseField("script"), ObjectParser.ValueType.OBJECT);
363358
PARSER.declareString(ReindexRequest::setConflicts, new ParseField("conflicts"));
364359
}
@@ -498,10 +493,4 @@ static void setMaxDocsValidateIdentical(AbstractBulkByScrollRequest<?> request,
498493
request.setMaxDocs(maxDocs);
499494
}
500495
}
501-
502-
@UpdateForV9(owner = UpdateForV9.Owner.DISTRIBUTED_INDEXING)
503-
// do we still need this ref to [max_docs] or can we remove the field entirely so it's rejected with the default message?
504-
private static void failOnSizeSpecified() {
505-
throw new IllegalArgumentException("invalid parameter [size], use [max_docs] instead");
506-
}
507496
}

0 commit comments

Comments
 (0)