From e86813a655a836561ff78fbd6bb077954dd7acb8 Mon Sep 17 00:00:00 2001 From: Martijn van Groningen Date: Thu, 10 Sep 2015 11:30:52 +0200 Subject: [PATCH] test: fixed some other compile errors due to the removal of filtered query Original commit: elastic/x-pack-elasticsearch@30ae66827ac4f754cb0c2a25ba9ccbe040526012 --- .../watcher/input/search/SearchInputTests.java | 6 +++--- .../watcher/license/LicenseIntegrationTests.java | 6 +++--- .../watcher/test/integration/BasicWatcherTests.java | 12 ++++++------ .../transform/search/SearchTransformTests.java | 12 ++++++------ 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/watcher/src/test/java/org/elasticsearch/watcher/input/search/SearchInputTests.java b/watcher/src/test/java/org/elasticsearch/watcher/input/search/SearchInputTests.java index 7a25d03b9b6..6de99238dbc 100644 --- a/watcher/src/test/java/org/elasticsearch/watcher/input/search/SearchInputTests.java +++ b/watcher/src/test/java/org/elasticsearch/watcher/input/search/SearchInputTests.java @@ -109,7 +109,7 @@ public class SearchInputTests extends ESIntegTestCase { @Test public void testExecute() throws Exception { SearchSourceBuilder searchSourceBuilder = searchSource().query( - filteredQuery(matchQuery("event_type", "a"), rangeQuery("_timestamp").from("{{ctx.trigger.scheduled_time}}||-30s").to("{{ctx.trigger.triggered_time}}"))); + boolQuery().must(matchQuery("event_type", "a")).must(rangeQuery("_timestamp").from("{{ctx.trigger.scheduled_time}}||-30s").to("{{ctx.trigger.triggered_time}}"))); SearchRequest request = client() .prepareSearch() .setSearchType(ExecutableSearchInput.DEFAULT_SEARCH_TYPE) @@ -213,7 +213,7 @@ public class SearchInputTests extends ESIntegTestCase { @Test public void testDifferentSearchType() throws Exception { SearchSourceBuilder searchSourceBuilder = searchSource().query( - filteredQuery(matchQuery("event_type", "a"), rangeQuery("_timestamp").from("{{ctx.trigger.scheduled_time}}||-30s").to("{{ctx.trigger.triggered_time}}")) + boolQuery().must(matchQuery("event_type", "a")).must(rangeQuery("_timestamp").from("{{ctx.trigger.scheduled_time}}||-30s").to("{{ctx.trigger.triggered_time}}")) ); SearchType searchType = getRandomSupportedSearchType(); @@ -252,7 +252,7 @@ public class SearchInputTests extends ESIntegTestCase { .setSearchType(ExecutableSearchInput.DEFAULT_SEARCH_TYPE) .request() .source(searchSource() - .query(filteredQuery(matchQuery("event_type", "a"), rangeQuery("_timestamp").from("{{ctx.trigger.scheduled_time}}||-30s").to("{{ctx.trigger.triggered_time}}")))); + .query(boolQuery().must(matchQuery("event_type", "a")).must(rangeQuery("_timestamp").from("{{ctx.trigger.scheduled_time}}||-30s").to("{{ctx.trigger.triggered_time}}")))); TimeValue timeout = randomBoolean() ? TimeValue.timeValueSeconds(randomInt(10)) : null; XContentBuilder builder = jsonBuilder().value(new SearchInput(request, null, timeout, null)); diff --git a/watcher/src/test/java/org/elasticsearch/watcher/license/LicenseIntegrationTests.java b/watcher/src/test/java/org/elasticsearch/watcher/license/LicenseIntegrationTests.java index 4fbafbf5191..41d0853440b 100644 --- a/watcher/src/test/java/org/elasticsearch/watcher/license/LicenseIntegrationTests.java +++ b/watcher/src/test/java/org/elasticsearch/watcher/license/LicenseIntegrationTests.java @@ -160,9 +160,9 @@ public class LicenseIntegrationTests extends AbstractWatcherIntegrationTestCase assertThat(docCount("idx", "type", matchAllQuery()), is(docCountBeforeDisable)); // and last... lets verify that we have throttled watches due to license expiration - long throttledCount = docCount(HistoryStore.INDEX_PREFIX + "*", HistoryStore.DOC_TYPE, filteredQuery( - matchQuery("result.actions.reason", "watcher license expired"), - termQuery("result.actions.status", "throttled"))); + long throttledCount = docCount(HistoryStore.INDEX_PREFIX + "*", HistoryStore.DOC_TYPE, boolQuery() + .must(matchQuery("result.actions.reason", "watcher license expired")) + .must(termQuery("result.actions.status", "throttled"))); assertThat(throttledCount, is(1L)); //===== diff --git a/watcher/src/test/java/org/elasticsearch/watcher/test/integration/BasicWatcherTests.java b/watcher/src/test/java/org/elasticsearch/watcher/test/integration/BasicWatcherTests.java index 097678387ef..c6f55df869b 100644 --- a/watcher/src/test/java/org/elasticsearch/watcher/test/integration/BasicWatcherTests.java +++ b/watcher/src/test/java/org/elasticsearch/watcher/test/integration/BasicWatcherTests.java @@ -285,9 +285,9 @@ public class BasicWatcherTests extends AbstractWatcherIntegrationTestCase { @Test public void testConditionSearchWithSource() throws Exception { String variable = randomFrom("ctx.execution_time", "ctx.trigger.scheduled_time", "ctx.trigger.triggered_time"); - SearchSourceBuilder searchSourceBuilder = searchSource().query(filteredQuery( - matchQuery("level", "a"), - rangeQuery("_timestamp") + SearchSourceBuilder searchSourceBuilder = searchSource().query(boolQuery() + .must(matchQuery("level", "a")) + .must(rangeQuery("_timestamp") .from("{{" + variable + "}}||-30s") .to("{{" + variable + "}}"))); @@ -297,9 +297,9 @@ public class BasicWatcherTests extends AbstractWatcherIntegrationTestCase { @Test public void testConditionSearchWithIndexedTemplate() throws Exception { String variable = randomFrom("ctx.execution_time", "ctx.trigger.scheduled_time", "ctx.trigger.triggered_time"); - SearchSourceBuilder searchSourceBuilder = searchSource().query(filteredQuery( - matchQuery("level", "a"), - rangeQuery("_timestamp") + SearchSourceBuilder searchSourceBuilder = searchSource().query(boolQuery() + .must(matchQuery("level", "a")) + .must(rangeQuery("_timestamp") .from("{{" + variable + "}}||-30s") .to("{{" + variable + "}}"))); diff --git a/watcher/src/test/java/org/elasticsearch/watcher/transform/search/SearchTransformTests.java b/watcher/src/test/java/org/elasticsearch/watcher/transform/search/SearchTransformTests.java index 683588c6506..e0b971ee4ac 100644 --- a/watcher/src/test/java/org/elasticsearch/watcher/transform/search/SearchTransformTests.java +++ b/watcher/src/test/java/org/elasticsearch/watcher/transform/search/SearchTransformTests.java @@ -205,10 +205,10 @@ public class SearchTransformTests extends ESIntegTestCase { ensureGreen("idx"); refresh(); - SearchRequest request = Requests.searchRequest("idx").source(searchSource().query(filteredQuery(matchAllQuery(), boolQuery() + SearchRequest request = Requests.searchRequest("idx").source(searchSource().query(boolQuery() .must(rangeQuery("date").gt("{{ctx.trigger.scheduled_time}}")) .must(rangeQuery("date").lt("{{ctx.execution_time}}")) - .must(termQuery("value", "{{ctx.payload.value}}"))))); + .must(termQuery("value", "{{ctx.payload.value}}")))); SearchTransform searchTransform = TransformBuilders.searchTransform(request).build(); ExecutableSearchTransform transform = new ExecutableSearchTransform(searchTransform, logger, ClientProxy.of(client()), null, new DynamicIndexName.Parser()); @@ -223,7 +223,7 @@ public class SearchTransformTests extends ESIntegTestCase { assertThat(result.type(), is(SearchTransform.TYPE)); SearchResponse response = client().prepareSearch("idx").setQuery( - filteredQuery(matchAllQuery(), termQuery("value", "val_3"))) + termQuery("value", "val_3")) .get(); Payload expectedPayload = new Payload.XContent(response); @@ -454,9 +454,9 @@ public class SearchTransformTests extends ESIntegTestCase { public void testDifferentSearchType() throws Exception { WatchExecutionContext ctx = createContext(); - SearchSourceBuilder searchSourceBuilder = searchSource().query(filteredQuery( - matchQuery("event_type", "a"), - rangeQuery("_timestamp") + SearchSourceBuilder searchSourceBuilder = searchSource().query(boolQuery() + .must(matchQuery("event_type", "a")) + .must(rangeQuery("_timestamp") .from("{{ctx.trigger.scheduled_time}}||-30s") .to("{{ctx.trigger.triggered_time}}")));