I am trying to bulk update few fields in my documents using Rest Client. Here is how my code looks like :
String updateLastUsedTimeInBulkPath = "/_bulk"; // Tried with just "_bulk" also
StringEntity updateLastUsedTimeRequest = new StringEntity(jsonStringToUpdateLastUsedTimeInBulk);
updateLastUsedTimeRequest.setContentType("application/x-ndjson");
elasticServerRestClient.performRequest("POST", updateLastUsedTimeInBulkPath, Collections.<String, String>emptyMap(), updateLastUsedTimeRequest);
jsonStringToUpdateLastUsedTimeInBulk in the above code looks like the following :
{ "update" : {"_index" : "routematch", "_type" : "routematch", "_id" : "2686101,8264892"} }
{ "doc" : {"lastUsedTime" : "1519221900208"} }
{ "update" : {"_index" : "routematch", "_type" : "routematch", "_id" : "2686101,2686101"} }
{ "doc" : {"lastUsedTime" : "1519221900209"} }
I tried to execute the same using Kibana and it worked fine and updated the fields, but it always fails when executed using RestClient with java.io.IOException: An existing connection was forcibly closed by the remote host
What is wrong with my code? I have tried the bulk API to index documents and it works fine. Why is update failing?