Maximum length of a specified document ID

I think there is a maximum now.
When I upgraded to ES V5.0, I got messages of the form:

id is too long, must be no longer than 512 bytes but was 1010

and a google search found this file:

https://github.com/elastic/elasticsearch/blob/master/core/src/main/java/org/elasticsearch/action/index/IndexRequest.java

with this requirement:

    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: " +
                        id.getBytes(StandardCharsets.UTF_8).length, validationException);
    }
2 Likes