test: fixed some other compile errors due to the removal of filtered query

Original commit: elastic/x-pack-elasticsearch@30ae66827a
This commit is contained in:
Martijn van Groningen 2015-09-10 11:30:52 +02:00
parent 427891191f
commit e86813a655
4 changed files with 18 additions and 18 deletions

View File

@ -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));

View File

@ -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));
//=====

View File

@ -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 + "}}")));

View File

@ -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}}")));