Bulk Processor api not working

HI,

I am trying to insert data into elasticsearch using java bulkprocessor api (in scala)...below is the code i am using...

val bulkProcessor = BulkProcessor.builder(esclient, new BulkProcessor.Listener() {
        @Override
        def beforeBulk(executionId: Long, request: BulkRequest) {
          log.info("Bulk Going to execute new bulk composed of {} actions" + request.numberOfActions());
        }

        @Override
        def afterBulk(executionId: Long, request: BulkRequest, response: BulkResponse) {
          log.info("Executed bulk composed of {} actions" + request.numberOfActions());
        }

        @Override
        def afterBulk(executionId: Long, request: BulkRequest, failure: Throwable) {
          log.info("Error executing bulk", failure);
        }
      }).setBulkActions(1000).setConcurrentRequests(1).setFlushInterval(TimeValue.timeValueMillis(5)).build();

Add 30-40 records

 val indexRequest =
          new IndexRequest(indexName, mappingName, tag.tagid)
            .source(builder);
        val updateRequest =
          new UpdateRequest(indexName, mappingName, tag.tagid) //.addScriptParam("newobj", builder).script("ctx.objectids+=newobj")
            .doc(builder)
            .upsert(indexRequest);

        bulkProcessor.add(updateRequest)

And then call the below method

bulkProcessor.awaitClose(10, TimeUnit.SECONDS)

But, i dont see the data indexed to elastic search. I only see the log from beforebulk. I dont see any log from afterbulk....

Am i missing anything?

Thanks,
Malini

Please format your code using </> icon as explained in this guide. It will make your post more readable.

I edited your question.

Just a comment here. Don't send bulk requests every 5ms. It does not make sense.
Use something like 5s, even more.

Not sure it would help.

The other part of the code looks ok.

Thanks David....i tried with 5s also, but no luck. I don't see data indexed to elastic search...

Thanks,
Malini

Do you see any Bulk Going to execute new bulk composed?

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