|  | @@ -24,10 +24,12 @@ import org.apache.lucene.search.BooleanQuery;
 | 
	
		
			
				|  |  |  import org.apache.lucene.search.ConstantScoreQuery;
 | 
	
		
			
				|  |  |  import org.apache.lucene.search.Query;
 | 
	
		
			
				|  |  |  import org.elasticsearch.cluster.metadata.MetaData;
 | 
	
		
			
				|  |  | +import org.elasticsearch.common.lucene.search.MatchNoDocsQuery;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import java.io.IOException;
 | 
	
		
			
				|  |  |  import java.util.Collection;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +import static org.hamcrest.CoreMatchers.containsString;
 | 
	
		
			
				|  |  |  import static org.hamcrest.CoreMatchers.equalTo;
 | 
	
		
			
				|  |  |  import static org.hamcrest.CoreMatchers.instanceOf;
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -56,9 +58,9 @@ public class ExistsQueryBuilderTests extends AbstractQueryTestCase<ExistsQueryBu
 | 
	
		
			
				|  |  |          String fieldPattern = queryBuilder.fieldName();
 | 
	
		
			
				|  |  |          Collection<String> fields = context.simpleMatchToIndexNames(fieldPattern);
 | 
	
		
			
				|  |  |          if (getCurrentTypes().length == 0) {
 | 
	
		
			
				|  |  | -            assertThat(query, instanceOf(BooleanQuery.class));
 | 
	
		
			
				|  |  | -            BooleanQuery booleanQuery = (BooleanQuery) query;
 | 
	
		
			
				|  |  | -            assertThat(booleanQuery.clauses().size(), equalTo(0));
 | 
	
		
			
				|  |  | +            assertThat(query, instanceOf(MatchNoDocsQuery.class));
 | 
	
		
			
				|  |  | +            MatchNoDocsQuery matchNoDocsQuery = (MatchNoDocsQuery) query;
 | 
	
		
			
				|  |  | +            assertThat(matchNoDocsQuery.toString(null), containsString("Missing types in \"exists\" query."));
 | 
	
		
			
				|  |  |          } else {
 | 
	
		
			
				|  |  |              assertThat(query, instanceOf(ConstantScoreQuery.class));
 | 
	
		
			
				|  |  |              ConstantScoreQuery constantScoreQuery = (ConstantScoreQuery) query;
 | 
	
	
		
			
				|  | @@ -79,11 +81,11 @@ public class ExistsQueryBuilderTests extends AbstractQueryTestCase<ExistsQueryBu
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      public void testFromJson() throws IOException {
 | 
	
		
			
				|  |  |          String json =
 | 
	
		
			
				|  |  | -                "{\n" + 
 | 
	
		
			
				|  |  | -                "  \"exists\" : {\n" + 
 | 
	
		
			
				|  |  | -                "    \"field\" : \"user\",\n" + 
 | 
	
		
			
				|  |  | -                "    \"boost\" : 42.0\n" + 
 | 
	
		
			
				|  |  | -                "  }\n" + 
 | 
	
		
			
				|  |  | +                "{\n" +
 | 
	
		
			
				|  |  | +                "  \"exists\" : {\n" +
 | 
	
		
			
				|  |  | +                "    \"field\" : \"user\",\n" +
 | 
	
		
			
				|  |  | +                "    \"boost\" : 42.0\n" +
 | 
	
		
			
				|  |  | +                "  }\n" +
 | 
	
		
			
				|  |  |                  "}";
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          ExistsQueryBuilder parsed = (ExistsQueryBuilder) parseQuery(json);
 |