public <T> ESDatas<T> searchAllParallel(String index,  final int fetchSize ,ScrollHandler<T> scrollHandler,final Class<T> type,int max) throws ElasticSearchException{
		if(!this.client.isV1()) {
			SliceScroll sliceScroll = new SliceScroll() {
				@Override
				public String buildSliceDsl(int sliceId, int max) {
					StringBuilder builder = new StringBuilder();
					String sliceDsl = builder.append("{\"slice\": {\"id\": ").append(sliceId).append(",\"max\": ")
							.append(max).append("},\"size\":").append(fetchSize).append(",\"query\": {\"match_all\": {}},\"sort\": [\"_doc\"]}").toString();
					return sliceDsl;
//				return buildSliceDsl(i,max, params, dslTemplate);
				}
			};

			return _slice(index + "/_search", scrollHandler, type, max, "1m", sliceScroll);
		}
		else{
			StringBuilder builder = new StringBuilder();
			String queryAll = builder.append("{ \"size\":").append(fetchSize).append(",\"query\": {\"match_all\": {}},\"sort\": [\"_doc\"]}").toString();
			builder.setLength(0);
			return this.scrollParallel(builder.append(index).append("/_search").toString(),queryAll,"10m",type,scrollHandler);
		}

	}
public < T > ESDatas < T > searchAllParallel ( String index , final int fetchSize , ScrollHandler < T > scrollHandler , final Class < T > type , int max ) throws ElasticSearchException { if ( ! this . client . isV1 ( ) ) { SliceScroll sliceScroll = new SliceScroll ( ) { @ Override public String buildSliceDsl ( int sliceId , int max ) { StringBuilder builder = new StringBuilder ( ) ; String sliceDsl = builder . append ( "{\"slice\": {\"id\": " ) . append ( sliceId ) . append ( ",\"max\": " ) . append ( max ) . append ( "},\"size\":" ) . append ( fetchSize ) . append ( ",\"query\": {\"match_all\": {}},\"sort\": [\"_doc\"]}" ) . toString ( ) ; return sliceDsl ; } } ; return _slice ( index + "/_search" , scrollHandler , type , max , "1m" , sliceScroll ) ; } else { StringBuilder builder = new StringBuilder ( ) ; String queryAll = builder . append ( "{ \"size\":" ) . append ( fetchSize ) . append ( ",\"query\": {\"match_all\": {}},\"sort\": [\"_doc\"]}" ) . toString ( ) ; builder . setLength ( 0 ) ; return this . scrollParallel ( builder . append ( index ) . append ( "/_search" ) . toString ( ) , queryAll , "10m" , type , scrollHandler ) ; } }
并行检索索引所有数据
@param index
@param fetchSize 指定每批次返回的数据，不指定默认为5000
@param scrollHandler 每批数据处理方法
@param type
@param <T>
@return
@throws ElasticSearchException