Skip to content
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

[9.0] Remove @UpdateForV9 annotation from ReindexRequest#failOnSizeSpecified (#122729) #122798

Merged
merged 1 commit into from
Feb 17, 2025
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
4 changes: 4 additions & 0 deletions modules/reindex/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -167,3 +167,7 @@ if (OS.current() == OS.WINDOWS) {
}
}
}

tasks.named("yamlRestCompatTestTransform").configure { task ->
task.skipTest("reindex/20_validation/specifying size fails", "size is rejected in 9.0")
}
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
body: { "text": "test" }

- do:
catch: /invalid parameter \[size\], use \[max_docs\] instead/
catch: /(invalid parameter \[size\], use \[max_docs\] instead|unknown field \[size\])/
reindex:
body:
source:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import org.elasticsearch.common.settings.SecureString;
import org.elasticsearch.common.xcontent.XContentHelper;
import org.elasticsearch.core.TimeValue;
import org.elasticsearch.core.UpdateForV9;
import org.elasticsearch.features.NodeFeature;
import org.elasticsearch.index.VersionType;
import org.elasticsearch.index.query.QueryBuilder;
Expand Down Expand Up @@ -355,10 +354,6 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
);

PARSER.declareInt(ReindexRequest::setMaxDocsValidateIdentical, new ParseField("max_docs"));

// avoid silently accepting an ignored size.
PARSER.declareInt((r, s) -> failOnSizeSpecified(), new ParseField("size"));

PARSER.declareField((p, v, c) -> v.setScript(Script.parse(p)), new ParseField("script"), ObjectParser.ValueType.OBJECT);
PARSER.declareString(ReindexRequest::setConflicts, new ParseField("conflicts"));
}
Expand Down Expand Up @@ -498,10 +493,4 @@ static void setMaxDocsValidateIdentical(AbstractBulkByScrollRequest<?> request,
request.setMaxDocs(maxDocs);
}
}

@UpdateForV9(owner = UpdateForV9.Owner.DISTRIBUTED_INDEXING)
// do we still need this ref to [max_docs] or can we remove the field entirely so it's rejected with the default message?
private static void failOnSizeSpecified() {
throw new IllegalArgumentException("invalid parameter [size], use [max_docs] instead");
}
}