Should BulkProcessor And RestHighLevelClient be shared in multi-thread?


(Yi Jiang) #1

In elasticsearch wiki, the BulkProcessor and the RestHighLevelClient are all thread safe, so they can be applied in multi-thread.

In my application, I want to improve bulk perforance, so I want to use multi-thread.

Also we know, the BulkProcessor needs RestClient as it's constructor parameter. So the best way is just one RestClient and one BulkProcessor? or just one RestClient and each BulkProcessor for every thread? or each RestClient and each BulkProcessor for every thread?

In my test, 10000 documents with size about 6M may costs more than 1 minute. As time goes by, the indexing speed may be slower.