class ElasticSearchRepository implements Constants {

	public List<Map<String, Object>> getSortedDataFromESBySize(String dataSource, String targetType,
			final Map<String, Object> mustFilter, final Map<String, Object> mustNotFilter,
			final HashMultimap<String, Object> shouldFilter, List<String> fields, int from, int size, String searchText,
			final Map<String, Object> mustTermsFilter, List<Map<String, Object>> sortFieldMapList) throws Exception {
		if (size <= 0) {
			size = (int) getTotalDocumentCountForIndexAndType(dataSource, targetType, mustFilter, mustNotFilter, null,
					searchText, mustTermsFilter);
		}
		StringBuilder urlToQueryBuffer = new StringBuilder(esUrl).append(FORWARD_SLASH).append(dataSource);
		if (!Strings.isNullOrEmpty(targetType)) {
			urlToQueryBuffer.append(FORWARD_SLASH).append(targetType);
		}
		urlToQueryBuffer.append(FORWARD_SLASH).append(_SEARCH);

		String urlToQuery = urlToQueryBuffer.toString();

		Map<String, Object> requestBody = new HashMap<String, Object>();
		requestBody.put(SIZE, ES_PAGE_SIZE);
		if ((from + size) < ES_PAGE_SIZE) {
			requestBody.put(SIZE, (from + size));
		}
		requestBody.put(QUERY, buildQuery(mustFilter, mustNotFilter, shouldFilter, searchText, mustTermsFilter,null));

		if (null != sortFieldMapList && !sortFieldMapList.isEmpty()) {
			requestBody.put(SORT, sortFieldMapList);
		}
		requestBody.put(_SOURCE, fields);
		Gson serializer = new GsonBuilder().create();
		String request = serializer.toJson(requestBody);
		return prepareResultsUsingScroll(from, size, urlToQuery, request);
	}

}