Source:
private SearchRequestBuilder buildQuery(EnumSet<ElasticsearchDocumentType> elementType, FetchHints fetchHints, boolean includeAggregations) { if (QUERY_LOGGER.isTraceEnabled()) { QUERY_LOGGER.trace("searching for: " + toString()); } List<QueryBuilder> filters = getFilters(elementType, fetchHints); QueryBuilder query = createQuery(getParameters()); QueryBuilder filterBuilder = getFilterBuilder(filters); String[] indicesToQuery = getIndexSelectionStrategy().getIndicesToQuery(this, elementType); if (QUERY_LOGGER.isTraceEnabled()) { QUERY_LOGGER.trace("indicesToQuery: %s", Joiner.on(", ").join(indicesToQuery)); } SearchRequestBuilder searchRequestBuilder = getClient() .prepareSearch(indicesToQuery) .setTypes(getSearchIndex().getIdStrategy().getType()) .setQuery(QueryBuilders.boolQuery().must(query).filter(filterBuilder)) .storedFields( Elasticsearch5SearchIndex.ELEMENT_ID_FIELD_NAME, Elasticsearch5SearchIndex.ELEMENT_TYPE_FIELD_NAME, Elasticsearch5SearchIndex.OUT_VERTEX_ID_FIELD_NAME, Elasticsearch5SearchIndex.IN_VERTEX_ID_FIELD_NAME, Elasticsearch5SearchIndex.EDGE_LABEL_FIELD_NAME, Elasticsearch5SearchIndex.EXTENDED_DATA_TABLE_NAME_FIELD_NAME, Elasticsearch5SearchIndex.EXTENDED_DATA_TABLE_ROW_ID_FIELD_NAME ); if (getParameters().getMinScore() != null) { searchRequestBuilder.setMinScore(getParameters().getMinScore().floatValue()); } if (includeAggregations) { List<AggregationBuilder> aggs = getElasticsearchAggregations(getAggregations()); for (AggregationBuilder aggregationBuilder : aggs) { searchRequestBuilder.addAggregation(aggregationBuilder); } } applySort(searchRequestBuilder); return searchRequestBuilder; }

Target:
private SearchRequestBuilder buildQuery(EnumSet<ElasticsearchDocumentType> elementType, FetchHints fetchHints, boolean includeAggregations) { if (QUERY_LOGGER.isTraceEnabled()) { QUERY_LOGGER.trace("searching for: " + toString()); } List<QueryBuilder> filters = getFilters(elementType, fetchHints); QueryBuilder query = createQuery(getParameters()); QueryBuilder filterBuilder = getFilterBuilder(filters); String[] indicesToQuery = getIndexSelectionStrategy().getIndicesToQuery(this, elementType); if (QUERY_LOGGER.isTraceEnabled()) { QUERY_LOGGER.trace("indicesToQuery: %s", Joiner.on(", ").join(indicesToQuery)); } SearchRequestBuilder searchRequestBuilder = getClient() .prepareSearch(indicesToQuery) .setTypes(getSearchIndex().getIdStrategy().getType()) .setQuery(QueryBuilders.boolQuery().must(query).filter(filterBuilder)) .storedFields( Elasticsearch5SearchIndex.ELEMENT_ID_FIELD_NAME, Elasticsearch5SearchIndex.ELEMENT_TYPE_FIELD_NAME, Elasticsearch5SearchIndex.EXTENDED_DATA_TABLE_NAME_FIELD_NAME, Elasticsearch5SearchIndex.EXTENDED_DATA_TABLE_ROW_ID_FIELD_NAME ); if (fetchHints.equals(FetchHints.NONE)) { searchRequestBuilder.storedFields( Elasticsearch5SearchIndex.OUT_VERTEX_ID_FIELD_NAME, Elasticsearch5SearchIndex.IN_VERTEX_ID_FIELD_NAME, Elasticsearch5SearchIndex.EDGE_LABEL_FIELD_NAME ); } if (getParameters().getMinScore() != null) { searchRequestBuilder.setMinScore(getParameters().getMinScore().floatValue()); } if (includeAggregations) { List<AggregationBuilder> aggs = getElasticsearchAggregations(getAggregations()); for (AggregationBuilder aggregationBuilder : aggs) { searchRequestBuilder.addAggregation(aggregationBuilder); } } applySort(searchRequestBuilder); return searchRequestBuilder; }