Add dfs test

This commit is contained in:
Shay Banon 2011-07-26 09:16:44 +03:00
parent 4695618c27
commit cc1415e281
1 changed files with 5 additions and 0 deletions

View File

@ -23,6 +23,7 @@ import org.elasticsearch.action.admin.indices.status.IndicesStatusResponse;
import org.elasticsearch.action.delete.DeleteResponse; import org.elasticsearch.action.delete.DeleteResponse;
import org.elasticsearch.action.get.GetResponse; import org.elasticsearch.action.get.GetResponse;
import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.action.search.SearchType;
import org.elasticsearch.client.Client; import org.elasticsearch.client.Client;
import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.search.facet.FacetBuilders; import org.elasticsearch.search.facet.FacetBuilders;
@ -116,6 +117,10 @@ public class SimpleNestedTests extends AbstractNodesTests {
assertThat(Arrays.toString(searchResponse.shardFailures()), searchResponse.failedShards(), equalTo(0)); assertThat(Arrays.toString(searchResponse.shardFailures()), searchResponse.failedShards(), equalTo(0));
assertThat(searchResponse.hits().totalHits(), equalTo(1l)); assertThat(searchResponse.hits().totalHits(), equalTo(1l));
searchResponse = client.prepareSearch("test").setQuery(nestedQuery("nested1", termQuery("nested1.n_field1", "n_value1_1"))).setSearchType(SearchType.DFS_QUERY_THEN_FETCH).execute().actionGet();
assertThat(Arrays.toString(searchResponse.shardFailures()), searchResponse.failedShards(), equalTo(0));
assertThat(searchResponse.hits().totalHits(), equalTo(1l));
// add another doc, one that would match if it was not nested... // add another doc, one that would match if it was not nested...
client.prepareIndex("test", "type1", "2").setSource(jsonBuilder().startObject() client.prepareIndex("test", "type1", "2").setSource(jsonBuilder().startObject()