Issues about BulkProcessor with JAVA High Level Client

i was trying to use bulkprocessor with java high level client. I copied the demo code in https://www.elastic.co/guide/en/elasticsearch/client/java-rest/current/java-rest-high-document-bulk.html .However, it tells that it can't work and shows that there is no request added to bulkrequest. then i add one more line of codes as follows

bulkRequest.add(new IndexRequest("articles", "article", String.valueOf(j)).source(lineTxt, XContentType.JSON));
bulkProcessor.add(new IndexRequest("articles", "article", String.valueOf(j)).source(lineTxt, XContentType.JSON));

then it works. i dont why? it is supposed that only use bulkProcessor.add which will lead to the bulkRequest's addition of new request. Anyone helps?

I'm not sure I understand the question or the problem.

Anyway, here is how I'm using the bulk processor:

Create bulk processor:

Save a Java bean in elasticsearch:

Hoe this helps.

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