diff --git a/src/test/java/org/elasticsearch/indices/analysis/PreBuiltAnalyzerIntegrationTests.java b/src/test/java/org/elasticsearch/indices/analysis/PreBuiltAnalyzerIntegrationTests.java index 34bb7f7daef..c3360dcd2b6 100644 --- a/src/test/java/org/elasticsearch/indices/analysis/PreBuiltAnalyzerIntegrationTests.java +++ b/src/test/java/org/elasticsearch/indices/analysis/PreBuiltAnalyzerIntegrationTests.java @@ -54,9 +54,9 @@ public class PreBuiltAnalyzerIntegrationTests extends ElasticsearchIntegrationTe @Test public void testThatPreBuiltAnalyzersAreNotClosedOnIndexClose() throws Exception { Map> loadedAnalyzers = Maps.newHashMap(); - List indexNames = Lists.newArrayList(); - for (int i = 0; i < 10; i++) { + final int numIndices = scaledRandomIntBetween(2, 4); + for (int i = 0; i < numIndices; i++) { String indexName = randomAsciiOfLength(10).toLowerCase(Locale.ROOT); indexNames.add(indexName); @@ -87,13 +87,14 @@ public class PreBuiltAnalyzerIntegrationTests extends ElasticsearchIntegrationTe ensureGreen(); + final int numDocs = randomIntBetween(10, 100); // index some amount of data - for (int i = 0; i < 100; i++) { + for (int i = 0; i < numDocs; i++) { String randomIndex = indexNames.get(randomInt(indexNames.size()-1)); String randomId = randomInt() + ""; Map data = Maps.newHashMap(); - data.put("foo", randomAsciiOfLength(50)); + data.put("foo", randomAsciiOfLength(scaledRandomIntBetween(5, 50))); index(randomIndex, "type", randomId, data); } @@ -101,7 +102,7 @@ public class PreBuiltAnalyzerIntegrationTests extends ElasticsearchIntegrationTe refresh(); // close some of the indices - int amountOfIndicesToClose = randomInt(10-1); + int amountOfIndicesToClose = randomInt(numIndices-1); for (int i = 0; i < amountOfIndicesToClose; i++) { String indexName = indexNames.get(i); client().admin().indices().prepareClose(indexName).execute().actionGet();