@Test public void testQueryLessEqualFilter() throws FoxtrotException, JsonProcessingException { Query query = new Query(); query.setTable(TestUtils.TEST_TABLE_NAME); query.setLimit(3); ResultSort resultSort = new ResultSort(); resultSort.setOrder(ResultSort.Order.desc); resultSort.setField("_timestamp"); query.setSort(resultSort); LessEqualFilter lessEqualFilter = new LessEqualFilter(); lessEqualFilter.setField("battery"); lessEqualFilter.setValue(48); query.setFilters(Lists.<Filter>newArrayList(lessEqualFilter)); List<Document> documents = new ArrayList<Document>(); documents.add( TestUtils.getDocument("Z", 1397658117004L, new Object[]{"os", "android", "device", "nexus", "battery", 24}, getMapper())); documents.add( TestUtils.getDocument("Y", 1397658117003L, new Object[]{"os", "android", "device", "nexus", "battery", 48}, getMapper())); QueryResponse actualResponse = QueryResponse.class.cast(getQueryExecutor().execute(query)); compare(documents, actualResponse.getDocuments()); }
@Override public ActionResponse execute(Query parameter) { SearchRequestBuilder search = getRequestBuilder(parameter); try { logger.info("Search: {}", search); SearchResponse response = search.execute() .actionGet(getGetQueryTimeout()); return getResponse(response, parameter); } catch (ElasticsearchException e) { throw FoxtrotExceptions.createQueryExecutionException(parameter, e); } }
FilterAction extends Action<Query> { @Override public ActionResponse execute(Query parameter) { SearchRequestBuilder search = getRequestBuilder(parameter); try { logger.info("Search: {}", search); SearchResponse response = search.execute() .actionGet(getGetQueryTimeout()); return getResponse(response, parameter); } catch (ElasticsearchException e) { throw FoxtrotExceptions.createQueryExecutionException(parameter, e); } } }
FilterAction extends Action<Query> { @Override public ActionResponse execute(Query parameter) { SearchRequestBuilder search = getRequestBuilder(parameter); try { logger.info("Search: {}", search); SearchResponse response = search.execute() .actionGet(getGetQueryTimeout()); return getResponse(response, parameter); } catch (ElasticsearchException e) { throw FoxtrotExceptions.createQueryExecutionException(parameter, e); } } FilterAction(Query parameter, AnalyticsLoader analyticsLoader); }
FilterAction extends Action<Query> { @Override public ActionResponse execute(Query parameter) { SearchRequestBuilder search = getRequestBuilder(parameter); try { logger.info("Search: {}", search); SearchResponse response = search.execute() .actionGet(getGetQueryTimeout()); return getResponse(response, parameter); } catch (ElasticsearchException e) { throw FoxtrotExceptions.createQueryExecutionException(parameter, e); } } FilterAction(Query parameter, AnalyticsLoader analyticsLoader); @Override void preprocess(); @Override String getMetricKey(); @Override String getRequestCacheKey(); @Override void validateImpl(Query parameter); @Override ActionResponse execute(Query parameter); @Override SearchRequestBuilder getRequestBuilder(Query parameter); @Override ActionResponse getResponse(org.elasticsearch.action.ActionResponse response, Query parameter); }
FilterAction extends Action<Query> { @Override public ActionResponse execute(Query parameter) { SearchRequestBuilder search = getRequestBuilder(parameter); try { logger.info("Search: {}", search); SearchResponse response = search.execute() .actionGet(getGetQueryTimeout()); return getResponse(response, parameter); } catch (ElasticsearchException e) { throw FoxtrotExceptions.createQueryExecutionException(parameter, e); } } FilterAction(Query parameter, AnalyticsLoader analyticsLoader); @Override void preprocess(); @Override String getMetricKey(); @Override String getRequestCacheKey(); @Override void validateImpl(Query parameter); @Override ActionResponse execute(Query parameter); @Override SearchRequestBuilder getRequestBuilder(Query parameter); @Override ActionResponse getResponse(org.elasticsearch.action.ActionResponse response, Query parameter);  }