使用此方法在ElasticSearch中上传大小为50 mb的巨大JSON字符串时-
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();
}
错误是
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"}
在可以发送10k批次的代码中放置一个计数器可能会起作用,但是我不确定如何做到这一点。
关于如何处理此问题的任何建议?