We are trying to switch from Java Transport Client to Java high level client but we get error "Unable to parse response body" with bulk batches over 10000 documents using high level client.
We had this with many configurations:
6.2 client over 6.2 server
6.5.1 client over 6.2 server
6.5.3 client over 6.5.3 server
For smaller batches, it works, but I cannot tell whether it is the size of the batch or if a bigger batch size means a bigger chance to get a bad document.
Here is the Error printed by our code:
2018/12/20 13:07:01 286-qes5.1.0-DEBUG-QESHost_elastic:bulkAdd() : bulk avant|
2018/12/20 13:07:05 964-qes5.1.0-ERROR:QESHost_elastic:bulkAdd(): Flush impossible:Unable to parse response body|
Here is our code:
public int bulkAdd() throws IOException {
int iret = 1;
BulkResponse bulkResponse = null;
try {
ses.log(null, "DEBUG", "QESHost_elastic:bulkAdd()", 3, "bulk avant");
bulkResponse = client.bulk(bulkRequest, RequestOptions.DEFAULT);
ses.log(null, "DEBUG", "QESHost_elastic:bulkAdd()", 3, "bulk apres", bulkResponse.hasFailures());
if (bulkResponse.hasFailures()) {
ses.log(null, "ERROR", "QESHost_elastic:bulkAdd()", 0, "Erreur", bulkResponse.buildFailureMessage());
// process failures by iterating through each bulk response item
int ii = 0;
for (BulkItemResponse bulkItemResponse : bulkResponse) {
if (bulkItemResponse.isFailed()) {
BulkItemResponse.Failure failure = bulkItemResponse.getFailure();
ses.log(null, "ERROR", "QESHost_elastic:bulkAdd()", 0, "Item index", bulkItemResponse.getIndex());
ses.log(null, "ERROR", "QESHost_elastic:bulkAdd()", 0, "Item id", bulkItemResponse.getId());
ses.log(null, "ERROR", "QESHost_elastic:bulkAdd()", 0, "Item itemId", bulkItemResponse.getItemId());
ses.log(null, "ERROR", "QESHost_elastic:bulkAdd()", 0, "Item error", failure.getMessage());
}
ii++;
}
iret = -1;
}
} catch (Exception e) {
**ses.log(con, "ERROR", "QESHost_elastic:bulkAdd()", 0, "Flush impossible", e.getMessage());**
e.getStackTrace();
ses.log(con, "ERROR", "QESHost_elastic:bulkAdd()", 0, "Erreur bulk flush", bulkResponse.hasFailures());
iret = -1;
}
return iret;
}
Is there a way to get more information on the reason of this failure ?
Since Java Transport client will soon be deprecated we would be far more comfortable with a working bulk indexing on Java High level client.