private SearchResponse doSearch(SearchRequestBuilder searchRequest, SearchQuery searchQuery) {
    if (searchQuery.getFilter() != null) {
      searchRequest.setPostFilter(searchQuery.getFilter());
    }

    if (CollectionUtils.isNotEmpty(searchQuery.getElasticsearchSorts())) {
      for (SortBuilder sort : searchQuery.getElasticsearchSorts()) {
        searchRequest.addSort(sort);
      }
    }

    if (CollectionUtils.isNotEmpty(searchQuery.getFacets())) {
      for (FacetRequest facetRequest : searchQuery.getFacets()) {
        FacetBuilder facet = facetRequest.getFacet();
        if (facetRequest.applyQueryFilter() && searchQuery.getFilter() != null) {
          facet.facetFilter(searchQuery.getFilter());
        }
        searchRequest.addFacet(facet);
      }
    }

    if (searchQuery.getHighlightFields() != null) {
      for (HighlightBuilder.Field highlightField : searchQuery.getHighlightFields()) {
        searchRequest.addHighlightedField(highlightField);
      }
    }

    if (CollectionUtils.isNotEmpty(searchQuery.getAggregations())) {
      for (AbstractAggregationBuilder aggregationBuilder : searchQuery.getAggregations()) {
        searchRequest.addAggregation(aggregationBuilder);
      }
    }

    return searchRequest.setQuery(searchQuery.getQuery()).execute().actionGet();
  }
 /**
  * Should the fact run in global mode (not bounded by the search query) or not. Defaults to
  * <tt>false</tt>.
  */
 public TermsFacetBuilder global(boolean global) {
   super.global(global);
   return this;
 }