Skip to content

Commit 1d2bfd1

Browse files
JaredTan95dnhatn
authored andcommitted
Include id to the error msg when it's too long (#49433)
1 parent 777f6d5 commit 1d2bfd1

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

server/src/main/java/org/elasticsearch/action/index/IndexRequest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ public ActionRequestValidationException validate() {
242242
validationException = DocWriteRequest.validateSeqNoBasedCASParams(this, validationException);
243243

244244
if (id != null && id.getBytes(StandardCharsets.UTF_8).length > 512) {
245-
validationException = addValidationError("id is too long, must be no longer than 512 bytes but was: " +
245+
validationException = addValidationError("id [" + id + "] is too long, must be no longer than 512 bytes but was: " +
246246
id.getBytes(StandardCharsets.UTF_8).length, validationException);
247247
}
248248

server/src/test/java/org/elasticsearch/action/index/IndexRequestTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public void testIndexingRejectsLongIds() {
102102
validate = request.validate();
103103
assertThat(validate, notNullValue());
104104
assertThat(validate.getMessage(),
105-
containsString("id is too long, must be no longer than 512 bytes but was: 513"));
105+
containsString("id [" + id + "] is too long, must be no longer than 512 bytes but was: 513"));
106106
}
107107

108108
public void testWaitForActiveShards() {

0 commit comments

Comments
 (0)