}
public JestSearchRequestBuilder getSearchRequestBuilder(@Nullable IndexQueryPath indexQueryPath, FilterBuilder filter) {
// Build request
JestSearchRequestBuilder request = new JestSearchRequestBuilder();
if (indexQueryPath != null) {
request.setIndices(indexQueryPath.index)
.setTypes(indexQueryPath.type);
}
request.setSearchType(io.searchbox.params.SearchType.QUERY_THEN_FETCH)
.setFilter(filter);
// set Query
if (StringUtils.isNotBlank(query)) {
request.setQuery(query);
} else {
request.setQuery(builder);
}
// set no Fields -> only return id and type
if (noField) {
request.setNoFields();
}
// Facets
for (FacetBuilder facet : facets) {
request.addFacet(facet);
}
// Sorting
for (SortBuilder sort : sorts) {
request.addSort(sort);
}
// Paging
if (from > -1) {
request.setFrom(from);
}
if (size > -1) {
request.setSize(size);
}
// Explain
if (explain) {
request.setExplain(true);
}
if (IndexClient.config.showRequest) {
if (StringUtils.isNotBlank(query)) {
Logger.debug("ElasticSearch : Query -> " + query);