Bulk-update using Rest Client throws IOException

(Shobhana Sriram) #1

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

(Luca Cavanna) #2

hi @shobhana ,
I have run your bulk request and it looks ok to me.

Could you maybe share your entire code, how you create your rest client instance etc ? Were you able to isolate the problem with this specific bulk request after you ingested those two documents that you are trying to update?


(system) #3

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.