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