Hi.
So I'm trying to index multiple documents using Bulk API in java.
My documents are valid (I checked if I can index them one by one - and it works).
The bulk API also works - partially, because from 169 documents, only 3 are indexed. Ids of my documents are unique.
This is how I'm building BulkProcessor:
BulkProcessor.builder(client, new BulkProcessor.Listener() {
@Override
public void beforeBulk(long executionId, BulkRequest request) {
}
@Override
public void afterBulk(long executionId, BulkRequest request, BulkResponse response) {
}
@Override
public void afterBulk(long executionId, BulkRequest request, Throwable failure) {
}
}).setBulkActions(2000)
.setBulkSize(new ByteSizeValue(500, ByteSizeUnit.MB))
.setFlushInterval(TimeValue.timeValueMinutes(5))
.setConcurrentRequests(1).build();
And this is how I add my documents to bulkProcessor:
bulkProcessor.add(indexRequest(indexName).type(INDEX_TYPE).source(
XContentFactory.jsonBuilder().map(data)));
What I'm doing step by step:
- Check if index with given name exists
- If it is, remove it
- Create new index
- Wait for cluster green status
- Create BulkProcessor
- Add indexRequests to bulkProcessor
- Close BulkProcessor
- Wait for Cluster green status
- Send refresh request
- Remove index with alias "indexaliasName"
- Add indexAliasName to index which was created in point number 3.
Any ideas what can be the reason of adding only three documents? Instead of 160 ?