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 96cc3624a3432..0f95239f06cac 100644 --- a/server/src/main/java/org/elasticsearch/action/index/IndexRequest.java +++ b/server/src/main/java/org/elasticsearch/action/index/IndexRequest.java @@ -198,7 +198,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 9d8518f23d750..21c56c7a3aa02 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() {