RestClient and Tranport client api

I used RestCLient and there I was appending following line
String actionMetaData = String.format("{ \"index\" : { \"_index\" : \"%s\", \"_type\" : \"%s\" } }%n", index, type);

This way I was creating my json for almost 500+ docs and then creating entity object and ingesting data to elasticsearch through RestClient.performRequest.

This operation was very quick. But now when I use transport client and try bulkprocessing it is taking so much time. Is there any way to do it similar to RestClient where I can give whole list of document in a single request as it is without iterating it.

I am having a json file which contains an array of elements. Array size is around 300/400. What I am doing is I am iterating over this array and taking single element as a one document adding that document to bulkProcessor. So what happens is it iterates over 300 elements adds to bulkProcessor one by one. This takes time. This is a single file containing 300 elements but I will be having so many files like this. So inserting let say 20 file's data takes almost 5mins or something. May be I will be doing it is some wrong way. Previously when I used RestClient I used to append the line which i have mentioned above to each document and just inserting all the element's array so that was a one time request for 300 docs and it was doing it very quickly so inserting data for 20 files was not taking more than a minute. Is there anything similar for transport client or bulkProcessor where I can give whole array of 300 elements at one go?

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