[TEST] Wait for yellow since some shards might not be started

In this test we only index a handful of docs so if we have more shards
than docs we might fail on the `assertSearchResult` since not all shards
are started but results are just fine.
This commit is contained in:
Simon Willnauer 2014-07-04 09:51:47 +02:00
parent 5249005578
commit a3d5cdcda8
1 changed files with 2 additions and 2 deletions

View File

@ -89,7 +89,7 @@ public class ExistsMissingTests extends ElasticsearchIntegrationTest {
for (Map<String, Object> source : sources) { for (Map<String, Object> source : sources) {
reqs.add(client().prepareIndex("idx", "type").setSource(source)); reqs.add(client().prepareIndex("idx", "type").setSource(source));
} }
indexRandom(true, reqs); indexRandom(true, reqs);
final Map<String, Integer> expected = new LinkedHashMap<String, Integer>(); final Map<String, Integer> expected = new LinkedHashMap<String, Integer>();
expected.put("foo", 1); expected.put("foo", 1);
@ -103,7 +103,7 @@ public class ExistsMissingTests extends ElasticsearchIntegrationTest {
expected.put("foobar", 0); expected.put("foobar", 0);
final long numDocs = client().prepareSearch("idx").execute().actionGet().getHits().totalHits(); final long numDocs = client().prepareSearch("idx").execute().actionGet().getHits().totalHits();
ensureYellow("idx");
for (Map.Entry<String, Integer> entry : expected.entrySet()) { for (Map.Entry<String, Integer> entry : expected.entrySet()) {
final String fieldName = entry.getKey(); final String fieldName = entry.getKey();
final int count = entry.getValue(); final int count = entry.getValue();