Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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 @@ -107,7 +107,7 @@
body: { "text": "test" }

- do:
catch: /invalid parameter \[size\], use \[max_docs\] instead/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we instead keep the test but generalize this regex to handle both the old specialized message and the new general one?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I've updated it!

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");
}
}