diff --git a/server/src/main/java/org/elasticsearch/action/index/IndexRequest.java b/server/src/main/java/org/elasticsearch/action/index/IndexRequest.java index 54f19431ef82e..e01fc7768cf32 100644 --- a/server/src/main/java/org/elasticsearch/action/index/IndexRequest.java +++ b/server/src/main/java/org/elasticsearch/action/index/IndexRequest.java @@ -242,7 +242,7 @@ public ActionRequestValidationException validate() { 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); } diff --git a/server/src/test/java/org/elasticsearch/action/index/IndexRequestTests.java b/server/src/test/java/org/elasticsearch/action/index/IndexRequestTests.java index e01cc511ba136..aa906331943d1 100644 --- a/server/src/test/java/org/elasticsearch/action/index/IndexRequestTests.java +++ b/server/src/test/java/org/elasticsearch/action/index/IndexRequestTests.java @@ -102,7 +102,7 @@ public void testIndexingRejectsLongIds() { 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() {