ElasticSearch error ""Message":"Request size exceeded 10485760 bytes"

Viewed 5443

While uploading a 50 mb size huge JSON string in ElasticSearch using this method -

public static void postData(String json, String index, String type) {
    RestClient client = RestClient.builder(new HttpHost(testHostPreProd, 443, "https")).build();
    HttpEntity entity = new NStringEntity(json, ContentType.APPLICATION_JSON);

    Response response = client.performRequest("POST", "/" + index + "/" + type + "/_bulk",
            Collections.<String, String>emptyMap(), entity);

    client.close();
}

The error is

Exception in thread "main" org.elasticsearch.client.ResponseException: POST https:someURL/indexHere/typeHere/_bulk: HTTP/1.1 413 Request Entity Too Large
{"Message":"Request size exceeded 10485760 bytes"}

Putting a counter in the code that works send 10k batches might work but I'm not sure how to do that.

Any suggestions on how to handle this issue?

0 Answers
Related