@Override
  public String scan(SearchQuery searchQuery, long scrollTimeInMillis, boolean noFields) {
    Assert.notNull(searchQuery.getIndices(), "No index defined for Query");
    Assert.notNull(searchQuery.getTypes(), "No type define for Query");
    Assert.notNull(searchQuery.getPageable(), "Query.pageable is required for scan & scroll");

    SearchRequestBuilder requestBuilder =
        client
            .prepareSearch(toArray(searchQuery.getIndices()))
            .setSearchType(SCAN)
            .setQuery(searchQuery.getQuery())
            .setTypes(toArray(searchQuery.getTypes()))
            .setScroll(TimeValue.timeValueMillis(scrollTimeInMillis))
            .setFrom(0)
            .setSize(searchQuery.getPageable().getPageSize());

    if (searchQuery.getFilter() != null) {
      requestBuilder.setPostFilter(searchQuery.getFilter());
    }

    if (isNotEmpty(searchQuery.getFields())) {
      requestBuilder.addFields(toArray(searchQuery.getFields()));
    }

    if (noFields) {
      requestBuilder.setNoFields();
    }
    return requestBuilder.execute().actionGet().getScrollId();
  }
 @Override
 public <T> FacetedPage<T> queryForPage(
     SearchQuery query, Class<T> clazz, SearchResultMapper mapper) {
   SearchResponse response = doSearch(prepareSearch(query, clazz), query);
   return mapper.mapResults(response, clazz, query.getPageable());
 }