Tests: Fix GroovyScriptTests to not depend on the way documents are routed to shards.

This commit is contained in:
Adrien Grand 2014-11-04 20:12:12 +01:00
parent dfeb12996b
commit fc84666756
1 changed files with 6 additions and 2 deletions

View File

@ -31,10 +31,14 @@ import java.util.List;
import static com.google.common.collect.Lists.newArrayList; import static com.google.common.collect.Lists.newArrayList;
import static org.elasticsearch.index.query.FilterBuilders.scriptFilter; import static org.elasticsearch.index.query.FilterBuilders.scriptFilter;
import static org.elasticsearch.index.query.QueryBuilders.*; import static org.elasticsearch.index.query.QueryBuilders.constantScoreQuery;
import static org.elasticsearch.index.query.QueryBuilders.functionScoreQuery;
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
import static org.elasticsearch.index.query.QueryBuilders.matchQuery;
import static org.elasticsearch.index.query.functionscore.ScoreFunctionBuilders.scriptFunction; import static org.elasticsearch.index.query.functionscore.ScoreFunctionBuilders.scriptFunction;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertOrderedSearchHits; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertOrderedSearchHits;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchHits;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;
/** /**
@ -119,7 +123,7 @@ public class GroovyScriptTests extends ElasticsearchIntegrationTest {
.boostMode(CombineFunction.REPLACE)).get(); .boostMode(CombineFunction.REPLACE)).get();
assertNoFailures(resp); assertNoFailures(resp);
assertOrderedSearchHits(resp, "3", "1"); assertSearchHits(resp, "3", "1");
// doc[] access // doc[] access
resp = client().prepareSearch("test").setQuery(functionScoreQuery(matchAllQuery()) resp = client().prepareSearch("test").setQuery(functionScoreQuery(matchAllQuery())