Include id to the error msg when it's too long (#49433)

This commit is contained in:
Jared Tan 2019-11-25 02:07:11 +08:00 committed by Nhat Nguyen
parent 777f6d5da6
commit 1d2bfd1af6
2 changed files with 2 additions and 2 deletions

View File

@ -242,7 +242,7 @@ public class IndexRequest extends ReplicatedWriteRequest<IndexRequest> implement
validationException = DocWriteRequest.validateSeqNoBasedCASParams(this, validationException);
if (id != null && id.getBytes(StandardCharsets.UTF_8).length > 512) {
validationException = addValidationError("id is too long, must be no longer than 512 bytes but was: " +
validationException = addValidationError("id [" + id + "] is too long, must be no longer than 512 bytes but was: " +
id.getBytes(StandardCharsets.UTF_8).length, validationException);
}

View File

@ -102,7 +102,7 @@ public class IndexRequestTests extends ESTestCase {
validate = request.validate();
assertThat(validate, notNullValue());
assertThat(validate.getMessage(),
containsString("id is too long, must be no longer than 512 bytes but was: 513"));
containsString("id [" + id + "] is too long, must be no longer than 512 bytes but was: 513"));
}
public void testWaitForActiveShards() {