[TEST] wait for yellow before searching

This commit is contained in:
Britta Weber 2014-12-12 17:34:07 +01:00
parent 2dc9392a34
commit 185521be4b
1 changed files with 2 additions and 0 deletions

View File

@ -442,6 +442,7 @@ public class FunctionScoreTests extends ElasticsearchIntegrationTest {
public void testMinScoreFunctionScoreBasic() throws IOException {
index(INDEX, TYPE, jsonBuilder().startObject().field("num", 2).endObject());
refresh();
ensureYellow();
float score = randomFloat();
float minScore = randomFloat();
SearchResponse searchResponse = client().search(
@ -476,6 +477,7 @@ public class FunctionScoreTests extends ElasticsearchIntegrationTest {
docs.add(client().prepareIndex(INDEX, TYPE, Integer.toString(i)).setSource("num", i + scoreOffset));
}
indexRandom(true, docs);
ensureYellow();
String script = "return (doc['num'].value)";
int numMatchingDocs = numDocs + scoreOffset - minScore;
if (numMatchingDocs < 0) {