Bulk update with java API

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:

  1. Check if index with given name exists
  2. If it is, remove it
  3. Create new index
  4. Wait for cluster green status
  5. Create BulkProcessor
  6. Add indexRequests to bulkProcessor
  7. Close BulkProcessor
  8. Wait for Cluster green status
  9. Send refresh request
  10. Remove index with alias "indexaliasName"
  11. 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 ?

I'd trace results in both afterBulk methods to check what is happening.

Ehh, sorry for bothering. I did very terrible mistake.

My Models which I used were not new objects, so in fact I had a list of three modeles repeated many times.

Everything works now when I'm creating new Object per document of course..