fluid-api/src/main/java/com/fluidbpm/program/api/util/elasticsearch/ABaseESUtil.java
public final List<ElasticTypeAndId> searchAndConvertHitsToIdsOnly(
			QueryBuilder qbParam,
			String indexParam,
			int offsetParam,
			int limitParam,
			Long ... formTypesParam) {

		SearchHits searchHits = this.searchWithHits(
				qbParam,
				indexParam,
				true,
				offsetParam,
				limitParam,
				formTypesParam);

		List<ElasticTypeAndId> returnVal = null;

		long totalHits;
		if (searchHits != null && (totalHits = searchHits.getTotalHits()) > 0) {

			returnVal = new ArrayList();

			if((searchHits.getHits().length != totalHits) &&
					(searchHits.getHits().length != limitParam))
			{
				throw new FluidElasticSearchException(
						"The Hits and fetch count has mismatch. Total hits is '"+totalHits
								+"' while hits is '"+
								searchHits.getHits().length+"'.");
			}

			long iterationMax = totalHits;
			if(limitParam > 0 && totalHits > limitParam) {
				iterationMax = limitParam;
			}

			//Iterate...
			for(int index = 0;index < iterationMax;index++) {
				SearchHit searchHit = searchHits.getAt(index);
				String idAsString;
				if((idAsString = searchHit.getId()) == null) {
					continue;
				}

				returnVal.add(new ElasticTypeAndId(
						this.toLongSafe(idAsString),
						searchHit.getType()));
			}
		}

		return returnVal;
	}
public final List<ElasticTypeAndId> searchAndConvertHitsToIdsOnly(
			QueryBuilder qbParam,
			String indexParam,
			int offsetParam,
			int limitParam,
			Long ... formTypesParam) {

		SearchHits searchHits = this.searchWithHits(
				qbParam,
				indexParam,
				true,
				offsetParam,
				limitParam,
				formTypesParam);

		List<ElasticTypeAndId> returnVal = null;

		long totalHits;
		if (searchHits != null && (totalHits = searchHits.getTotalHits()) > 0) {

			returnVal = new ArrayList();

			if((searchHits.getHits().length != totalHits) &&
					(searchHits.getHits().length != limitParam))
			{
				throw new FluidElasticSearchException(
						"The Hits and fetch count has mismatch. Total hits is '"+totalHits
								+"' while hits is '"+
								searchHits.getHits().length+"'.");
			}

			long iterationMax = totalHits;
			if(limitParam > 0 && totalHits > limitParam) {
				iterationMax = limitParam;
			}

			//Iterate...
			for(int index = 0;index < iterationMax;index++) {
				SearchHit searchHit = searchHits.getAt(index);
				String idAsString;
				if((idAsString = searchHit.getId()) == null) {
					continue;
				}

				returnVal.add(new ElasticTypeAndId(
						this.toLongSafe(idAsString),
						searchHit.getType()));
			}
		}

		return returnVal;
	}
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 offsetParam The offset for the results to return.
@param limitParam The number of results to return.
@param formTypesParam The Id's for the Form Definitions to be returned.
@return The {@code ElasticTypeAndId} {@code List}.

@see Index
@see ElasticTypeAndId