public final SearchHits searchWithHits(
			QueryBuilder qbParam,
			String indexParam,
			boolean withNoFieldsParam,
			int offsetParam,
			int limitParam,
			Long ... formTypesParam
	) {
		if(this.client == null) {
			throw new ElasticsearchException("Elasticsearch client is not set.");
		}

		SearchRequestBuilder searchRequestBuilder = this.client.prepareSearch(
				//Indexes...
				indexParam)
				.setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
				.setQuery(qbParam)
				.setFrom(0)
				.setExplain(false);

		//No Fields...
		if (withNoFieldsParam) {
			searchRequestBuilder = searchRequestBuilder.storedFields(NO_FIELDS_MAPPER);
		}

		//The requested number of results...
		if(limitParam > 0)
		{
			searchRequestBuilder = searchRequestBuilder.setSize(limitParam);
		}

		if(offsetParam > -1){
			searchRequestBuilder = searchRequestBuilder.setFrom(offsetParam);
		}

		if(formTypesParam == null)
		{
			formTypesParam = new Long[]{};
		}

		//If Types is set...
		if(formTypesParam != null && formTypesParam.length > 0)
		{
			String[] formTypesAsString = new String[formTypesParam.length];
			for(int index = 0;index < formTypesParam.length;index++)
			{
				Long formTypeId = formTypesParam[index];
				if(formTypeId == null)
				{
					continue;
				}

				formTypesAsString[index] = formTypeId.toString();
			}
			searchRequestBuilder = searchRequestBuilder.setTypes(formTypesAsString);
		}

		//Perform the actual search...
		SearchResponse searchResponse = searchRequestBuilder.execute().actionGet();

		if (searchResponse == null) {
			return null;
		}

		return searchResponse.getHits();
	}
public final SearchHits searchWithHits(
			QueryBuilder qbParam,
			String indexParam,
			boolean withNoFieldsParam,
			int offsetParam,
			int limitParam,
			Long ... formTypesParam
	) {
		if(this.client == null) {
			throw new ElasticsearchException("Elasticsearch client is not set.");
		}

		SearchRequestBuilder searchRequestBuilder = this.client.prepareSearch(
				
				indexParam)
				.setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
				.setQuery(qbParam)
				.setFrom(0)
				.setExplain(false);

		
		if (withNoFieldsParam) {
			searchRequestBuilder = searchRequestBuilder.storedFields(NO_FIELDS_MAPPER);
		}

		
		if(limitParam > 0)
		{
			searchRequestBuilder = searchRequestBuilder.setSize(limitParam);
		}

		if(offsetParam > -1){
			searchRequestBuilder = searchRequestBuilder.setFrom(offsetParam);
		}

		if(formTypesParam == null)
		{
			formTypesParam = new Long[]{};
		}

		
		if(formTypesParam != null && formTypesParam.length > 0)
		{
			String[] formTypesAsString = new String[formTypesParam.length];
			for(int index = 0;index < formTypesParam.length;index++)
			{
				Long formTypeId = formTypesParam[index];
				if(formTypeId == null)
				{
					continue;
				}

				formTypesAsString[index] = formTypeId.toString();
			}
			searchRequestBuilder = searchRequestBuilder.setTypes(formTypesAsString);
		}

		
		SearchResponse searchResponse = searchRequestBuilder.execute().actionGet();

		if (searchResponse == null) {
			return null;
		}

		return searchResponse.getHits();
	}
public final SearchHits searchWithHits ( QueryBuilder qbParam , String indexParam , boolean withNoFieldsParam , int offsetParam , int limitParam , Long ... formTypesParam ) { if ( this . client == null ) { throw new ElasticsearchException ( "Elasticsearch client is not set." ) ; } SearchRequestBuilder searchRequestBuilder = this . client . prepareSearch ( //Indexes... indexParam ) . setSearchType ( SearchType . DFS_QUERY_THEN_FETCH ) . setQuery ( qbParam ) . setFrom ( 0 ) . setExplain ( false ) ; //No Fields... if ( withNoFieldsParam ) { searchRequestBuilder = searchRequestBuilder . storedFields ( NO_FIELDS_MAPPER ) ; } //The requested number of results... if ( limitParam > 0 ) { searchRequestBuilder = searchRequestBuilder . setSize ( limitParam ) ; } if ( offsetParam > - 1 ) { searchRequestBuilder = searchRequestBuilder . setFrom ( offsetParam ) ; } if ( formTypesParam == null ) { formTypesParam = new Long [ ] { } ; } //If Types is set... if ( formTypesParam != null && formTypesParam . length > 0 ) { String [ ] formTypesAsString = new String [ formTypesParam . length ] ; for ( int index = 0 ; index < formTypesParam . length ; index ++ ) { Long formTypeId = formTypesParam [ index ] ; if ( formTypeId == null ) { continue ; } formTypesAsString [ index ] = formTypeId . toString ( ) ; } searchRequestBuilder = searchRequestBuilder . setTypes ( formTypesAsString ) ; } //Perform the actual search... SearchResponse searchResponse = searchRequestBuilder . execute ( ) . actionGet ( ) ; if ( searchResponse == null ) { return null ; } return searchResponse . getHits ( ) ; }
Performs a search against the Elasticsearch instance with the {@code qbParam}.

@param qbParam The @{code QueryBuilder} to search with.
@param indexParam The Elasticsearch Index to use {@code (document, folder or table_field)}.
@param withNoFieldsParam Should fields be IGNORED returned.
@param offsetParam The offset for the results to return.
@param limitParam The max number of results to return.
@param formTypesParam The Id's for the Form Definitions to be returned.

@return The Elasticsearch {@code SearchHits}.
Performs a search against the Elasticsearch instance with the { @code qbParam } .