Maximum length of a specified document ID


(cwho) #1

Is there a limit on the maximum length of a document ID in elastic
search?

When I index docs, I pass in my desired IDs, and for some uses we are
using strings that can get quite long - like 600 characters, perhaps.
I like to know if there is a hard limit, or a performance limit, to
this.....

e.g.
curl -XPUT 'http://localhost:9200/twitter/tweet/AIFEFE723489SDKJSD...
(600 characters or more)'

Thanks!


Max length for _id type
(Shay Banon) #2

There isn't a limit, but it can become wasteful space / memory wise.
On Wednesday, April 20, 2011 at 7:37 AM, cwho80 wrote:

Is there a limit on the maximum length of a document ID in elastic
search?

When I index docs, I pass in my desired IDs, and for some uses we are
using strings that can get quite long - like 600 characters, perhaps.
I like to know if there is a hard limit, or a performance limit, to
this.....

e.g.
curl -XPUT 'http://localhost:9200/twitter/tweet/AIFEFE723489SDKJSD...
(600 characters or more)'

Thanks!


(Alex) #3

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);
    }

(system) #4