wait for yellow status before searching

This commit is contained in:
Shay Banon 2011-12-08 16:28:57 +02:00
parent 6585b09de6
commit 1fd5a48409
1 changed files with 3 additions and 0 deletions

View File

@ -323,6 +323,9 @@ public class SimpleQueryTests extends AbstractNodesTests {
client.admin().indices().prepareDelete().execute().actionGet(); client.admin().indices().prepareDelete().execute().actionGet();
client.prepareIndex("test", "type1", "1").setSource("field1", "value1").execute().actionGet(); client.prepareIndex("test", "type1", "1").setSource("field1", "value1").execute().actionGet();
client.admin().cluster().prepareHealth().setWaitForYellowStatus().execute().actionGet();
client.admin().indices().prepareRefresh().execute().actionGet(); client.admin().indices().prepareRefresh().execute().actionGet();
SearchResponse searchResponse = client.prepareSearch("test").setQuery(constantScoreQuery(termsFilter("field1", "value1").cacheKey("test1"))).execute().actionGet(); SearchResponse searchResponse = client.prepareSearch("test").setQuery(constantScoreQuery(termsFilter("field1", "value1").cacheKey("test1"))).execute().actionGet();