diff --git a/src/test/java/org/elasticsearch/test/integration/codecs/CodecTests.java b/src/test/java/org/elasticsearch/test/integration/codecs/CodecTests.java index e91947ef7e8..7ca7fb44533 100644 --- a/src/test/java/org/elasticsearch/test/integration/codecs/CodecTests.java +++ b/src/test/java/org/elasticsearch/test/integration/codecs/CodecTests.java @@ -77,10 +77,10 @@ public class CodecTests extends AbstractNodesTests { client.prepareIndex("test", "type1", "1").setSource("field1", "quick brown fox", "field2", "quick brown fox").execute().actionGet(); client.prepareIndex("test", "type1", "2").setSource("field1", "quick lazy huge brown fox", "field2", "quick lazy huge brown fox").setRefresh(true).execute().actionGet(); - SearchResponse searchResponse = client.prepareSearch().setQuery(QueryBuilders.matchQuery("field1", "quick brown").type(MatchQueryBuilder.Type.BOOLEAN)).execute().actionGet(); - assertThat(searchResponse.hits().totalHits(), equalTo(2l)); + SearchResponse searchResponse = client.prepareSearch().setQuery(QueryBuilders.matchQuery("field2", "quick brown").type(MatchQueryBuilder.Type.PHRASE).slop(0)).execute().actionGet(); + assertThat(searchResponse.hits().totalHits(), equalTo(1l)); try { - client.prepareSearch().setQuery(QueryBuilders.matchQuery("field1", "quick brown").type(MatchQueryBuilder.Type.PHRASE).slop(2)).execute().actionGet(); + client.prepareSearch().setQuery(QueryBuilders.matchQuery("field1", "quick brown").type(MatchQueryBuilder.Type.PHRASE).slop(0)).execute().actionGet(); } catch (SearchPhaseExecutionException e) { assertTrue(e.getMessage().endsWith("IllegalStateException[field \"field1\" was indexed without position data; cannot run PhraseQuery (term=quick)]; }")); } @@ -104,10 +104,10 @@ public class CodecTests extends AbstractNodesTests { client.prepareIndex("test", "type1", "1").setSource("field1", "quick brown fox", "field2", "quick brown fox").execute().actionGet(); client.prepareIndex("test", "type1", "2").setSource("field1", "quick lazy huge brown fox", "field2", "quick lazy huge brown fox").setRefresh(true).execute().actionGet(); - SearchResponse searchResponse = client.prepareSearch().setQuery(QueryBuilders.matchQuery("field1", "quick brown").type(MatchQueryBuilder.Type.BOOLEAN)).execute().actionGet(); - assertThat(searchResponse.hits().totalHits(), equalTo(2l)); + SearchResponse searchResponse = client.prepareSearch().setQuery(QueryBuilders.matchQuery("field2", "quick brown").type(MatchQueryBuilder.Type.PHRASE).slop(0)).execute().actionGet(); + assertThat(searchResponse.hits().totalHits(), equalTo(1l)); try { - client.prepareSearch().setQuery(QueryBuilders.matchQuery("field1", "quick brown").type(MatchQueryBuilder.Type.PHRASE).slop(2)).execute().actionGet(); + client.prepareSearch().setQuery(QueryBuilders.matchQuery("field1", "quick brown").type(MatchQueryBuilder.Type.PHRASE).slop(0)).execute().actionGet(); } catch (SearchPhaseExecutionException e) { assertTrue(e.getMessage().endsWith("IllegalStateException[field \"field1\" was indexed without position data; cannot run PhraseQuery (term=quick)]; }")); } diff --git a/src/test/java/org/elasticsearch/test/integration/search/query/SimpleQueryTests.java b/src/test/java/org/elasticsearch/test/integration/search/query/SimpleQueryTests.java index 221a3905580..bf7d35293ff 100644 --- a/src/test/java/org/elasticsearch/test/integration/search/query/SimpleQueryTests.java +++ b/src/test/java/org/elasticsearch/test/integration/search/query/SimpleQueryTests.java @@ -96,10 +96,10 @@ public class SimpleQueryTests extends AbstractNodesTests { client.prepareIndex("test", "type1", "1").setSource("field1", "quick brown fox", "field2", "quick brown fox").execute().actionGet(); client.prepareIndex("test", "type1", "2").setSource("field1", "quick lazy huge brown fox", "field2", "quick lazy huge brown fox").setRefresh(true).execute().actionGet(); - SearchResponse searchResponse = client.prepareSearch().setQuery(QueryBuilders.matchQuery("field1", "quick brown").type(MatchQueryBuilder.Type.BOOLEAN)).execute().actionGet(); - assertThat(searchResponse.hits().totalHits(), equalTo(2l)); + SearchResponse searchResponse = client.prepareSearch().setQuery(QueryBuilders.matchQuery("field2", "quick brown").type(MatchQueryBuilder.Type.PHRASE).slop(0)).execute().actionGet(); + assertThat(searchResponse.hits().totalHits(), equalTo(1l)); try { - client.prepareSearch().setQuery(QueryBuilders.matchQuery("field1", "quick brown").type(MatchQueryBuilder.Type.PHRASE).slop(2)).execute().actionGet(); + client.prepareSearch().setQuery(QueryBuilders.matchQuery("field1", "quick brown").type(MatchQueryBuilder.Type.PHRASE).slop(0)).execute().actionGet(); } catch (SearchPhaseExecutionException e) { assertTrue(e.getMessage().endsWith("IllegalStateException[field \"field1\" was indexed without position data; cannot run PhraseQuery (term=quick)]; }")); } @@ -122,10 +122,10 @@ public class SimpleQueryTests extends AbstractNodesTests { client.prepareIndex("test", "type1", "2").setSource("field1", "quick lazy huge brown fox", "field2", "quick lazy huge brown fox").setRefresh(true).execute().actionGet(); - SearchResponse searchResponse = client.prepareSearch().setQuery(QueryBuilders.matchQuery("field1", "quick brown").type(MatchQueryBuilder.Type.BOOLEAN)).execute().actionGet(); - assertThat(searchResponse.hits().totalHits(), equalTo(2l)); + SearchResponse searchResponse = client.prepareSearch().setQuery(QueryBuilders.matchQuery("field2", "quick brown").type(MatchQueryBuilder.Type.PHRASE).slop(0)).execute().actionGet(); + assertThat(searchResponse.hits().totalHits(), equalTo(1l)); try { - client.prepareSearch().setQuery(QueryBuilders.matchQuery("field1", "quick brown").type(MatchQueryBuilder.Type.PHRASE).slop(2)).execute().actionGet(); + client.prepareSearch().setQuery(QueryBuilders.matchQuery("field1", "quick brown").type(MatchQueryBuilder.Type.PHRASE).slop(0)).execute().actionGet(); } catch (SearchPhaseExecutionException e) { assertTrue(e.getMessage().endsWith("IllegalStateException[field \"field1\" was indexed without position data; cannot run PhraseQuery (term=quick)]; }")); }