Include id to the error msg when it's too long (#49433)
This commit is contained in:
parent
777f6d5da6
commit
1d2bfd1af6
|
@ -242,7 +242,7 @@ public class IndexRequest extends ReplicatedWriteRequest<IndexRequest> implement
|
||||||
validationException = DocWriteRequest.validateSeqNoBasedCASParams(this, validationException);
|
validationException = DocWriteRequest.validateSeqNoBasedCASParams(this, validationException);
|
||||||
|
|
||||||
if (id != null && id.getBytes(StandardCharsets.UTF_8).length > 512) {
|
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);
|
id.getBytes(StandardCharsets.UTF_8).length, validationException);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -102,7 +102,7 @@ public class IndexRequestTests extends ESTestCase {
|
||||||
validate = request.validate();
|
validate = request.validate();
|
||||||
assertThat(validate, notNullValue());
|
assertThat(validate, notNullValue());
|
||||||
assertThat(validate.getMessage(),
|
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() {
|
public void testWaitForActiveShards() {
|
||||||
|
|
Loading…
Reference in New Issue