diff --git a/src/test/java/org/elasticsearch/document/BulkTests.java b/src/test/java/org/elasticsearch/document/BulkTests.java index bc78a614744..713807835e1 100644 --- a/src/test/java/org/elasticsearch/document/BulkTests.java +++ b/src/test/java/org/elasticsearch/document/BulkTests.java @@ -216,7 +216,11 @@ public class BulkTests extends ElasticsearchIntegrationTest { createIndex("test"); ensureGreen(); - int numDocs = 2000; + int numDocs = scaledRandomIntBetween(100, 2000); + if (numDocs % 2 == 1) { + numDocs++; // this test needs an even num of docs + } + logger.info("Bulk-Indexing {} docs", numDocs); BulkRequestBuilder builder = client().prepareBulk(); for (int i = 0; i < numDocs; i++) { builder.add( @@ -356,11 +360,11 @@ public class BulkTests extends ElasticsearchIntegrationTest { .put(indexSettings()) .put("index.number_of_replicas", replica))); - int numDocs = 5000; - int bulk = 50; + int numDocs = scaledRandomIntBetween(100, 5000); + int bulk = scaledRandomIntBetween(1, 99); for (int i = 0; i < numDocs; ) { - BulkRequestBuilder builder = client().prepareBulk(); - for (int j = 0; j < bulk; j++, i++) { + final BulkRequestBuilder builder = client().prepareBulk(); + for (int j = 0; j < bulk && i < numDocs; j++, i++) { builder.add(client().prepareIndex("test", "type1", Integer.toString(i)).setSource("val", i)); } logger.info("bulk indexing {}-{}", i - bulk, i - 1);