Elasticsearch editing source code to accomodate _id field size more than 512 bytes

Hi,

We are trying to migrate elasticsearch 2.3 to elasticsearch 5.6,
We found the below error

{"error":{"root_cause":[{"type":"action_request_validation_exception","reason":"Validation Failed: 1: id is too long, must be no longer than 512 bytes but was: 541;"}],"type":"action_request_validation_exception","reason":"Validation Failed: 1: id is too long, must be no longer than 512 bytes but was: 541;"}

Since we have architectural as well as code dependencies on the _id, we could not reduce the size of the field as it would great impact on the business processing.
We have forked elasticsearch version 5.6 and removed the condition which checks for the size of the _id field:

[link] (https://github.com/elastic/elasticsearch/blob/6bd185317e108075a36bfd9aaae2f35755f8b6a0/server/src/main/java/org/elasticsearch/action/index/IndexRequest.java#L219)

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

Now we are able to index the data with large _id fields, But we would like to know the impact of commenting the condtion. Would it impact elasticsearch querying mechanism or any internal functioning in elasticsearch.

Possibly. Running a fork means you're not running a supported and fully-tested version of Elasticsearch, and we can't guarantee anything about its behaviour.