Java Code Examples for org.frameworkset.elasticsearch.client.ClientInterface#executeHttp()

The following examples show how to use org.frameworkset.elasticsearch.client.ClientInterface#executeHttp() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestMGet.java    From elasticsearch-gradle-example with Apache License 2.0 6 votes vote down vote up
@Test
public void testMgetWithDSL(){
	ClientInterface clientUtil = ElasticSearchHelper.getConfigRestClientUtil("esmapper/estrace/mget.xml");
	//通过执行dsl获取多个文档的内容
	List<String> ids = new ArrayList<String>();
	ids.add("10.21.20.168");
	ids.add("192.168.0.143");
	Map params = new HashMap();
	params.put("ids",ids);
	String response = clientUtil.executeHttp("_mget",
											 "testMget",//dsl定义名称
											 params, //存放文档id的参数
			                                 ClientUtil.HTTP_POST);
	System.out.println(response);
	List<Map> docs = clientUtil.mgetDocuments("_mget",
											"testMget",//dsl定义名称
											 params, //存放文档id的参数
											 Map.class);//返回文档对象类型
	System.out.println(docs);
}
 
Example 2
Source File: ParentChildTest.java    From elasticsearch-gradle-example with Apache License 2.0 6 votes vote down vote up
/**
 * 通过读取配置文件中的dsl json数据导入雇员和公司数据
 */
public void importClientInfoFromJsonData(){
	ClientInterface clientUtil = ElasticSearchHelper.getConfigRestClientUtil("esmapper/Client_Info.xml");


	clientUtil.executeHttp("client_info/basic/_bulk?refresh","bulkImportBasicData",ClientUtil.HTTP_POST);
	clientUtil.executeHttp("client_info/diagnosis/_bulk?refresh","bulkImportDiagnosisData",ClientUtil.HTTP_POST);
	clientUtil.executeHttp("client_info/medical/_bulk?refresh","bulkImportMedicalData",ClientUtil.HTTP_POST);
	clientUtil.executeHttp("client_info/exam/_bulk?refresh","bulkImportExamData",ClientUtil.HTTP_POST);
	long companycount = clientUtil.countAll("client_info/basic");
	System.out.println(companycount);
	long basiccount = clientUtil.countAll("client_info/basic");
	System.out.println(basiccount);
	long medicalcount = clientUtil.countAll("client_info/medical");
	System.out.println(medicalcount);
	long examcount = clientUtil.countAll("client_info/exam");
	System.out.println(examcount);
	long diagnosiscount = clientUtil.countAll("client_info/diagnosis");
	System.out.println(diagnosiscount);
}
 
Example 3
Source File: PingyinTest.java    From elasticsearch-gradle-example with Apache License 2.0 6 votes vote down vote up
@Test
public void updateDocument(){
	ClientInterface clientUtil = ElasticSearchHelper.getConfigRestClientUtil("esmapper/estrace/pinyin.xml");

	Map<String,String> params = new HashMap<String,String>();
	params.put("cityName","潭市");
	params.put("standardAddrId","38130122");
	params.put("detailName","tan市贵溪市花园办事处建设路四冶生活区2-11栋3单元1层101");
	params.put("location","28.292781,117.238963");
	params.put("countyName","贵溪市");

	String temp = clientUtil.executeHttp("pboos-map-adress-1503973107/boosmap/38130122/_update",
			"updateDocument",
			params,
			ClientInterface.HTTP_POST);
	System.out.println(temp);

}
 
Example 4
Source File: PingyinTest.java    From elasticsearch-gradle-example with Apache License 2.0 6 votes vote down vote up
@Test
public void importShopGood() throws IOException {

	ClientInterface clientUtil = ElasticSearchHelper.getRestClientUtil();
	String data = FileUtil.getFileContent("F:\\4_ASIA文档\\1_项目\\13_江西移动\\拼音搜索\\数据\\shops","UTF-8");
	long time = System.currentTimeMillis();

	String temp = clientUtil.executeHttp("_bulk",data, ClientUtil.HTTP_POST);
	System.out.println(temp);
	System.out.println("耗时:"+(System.currentTimeMillis() - time)+"毫秒");

	data = FileUtil.getFileContent("F:\\4_ASIA文档\\1_项目\\13_江西移动\\拼音搜索\\数据\\good","UTF-8");
	time = System.currentTimeMillis();

	temp = clientUtil.executeHttp("_bulk",data, ClientUtil.HTTP_POST);
	System.out.println(temp);
	System.out.println("耗时:"+(System.currentTimeMillis() - time)+"毫秒");

	data = FileUtil.getFileContent("F:\\4_ASIA文档\\1_项目\\13_江西移动\\拼音搜索\\数据\\orders","UTF-8");
	time = System.currentTimeMillis();

	temp = clientUtil.executeHttp("_bulk",data, ClientUtil.HTTP_POST);
	System.out.println(temp);
	System.out.println("耗时:"+(System.currentTimeMillis() - time)+"毫秒");
}
 
Example 5
Source File: ESTest.java    From elasticsearch-gradle-example with Apache License 2.0 6 votes vote down vote up
public void testCreateTempate() throws ParseException{

		ClientInterface clientUtil = ElasticSearchHelper.getConfigRestClientUtil("esmapper/estrace/ESTemplate.xml");
		//创建模板
		String response = clientUtil.createTempate("demotemplate_1",//模板名称
				"demoTemplate");//模板对应的脚本名称,在estrace/ESTemplate.xml中配置
		System.out.println("createTempate-------------------------");
		System.out.println(response);
		//获取模板
		/**
		 * 指定模板
		 * /_template/demoTemplate_1
		 * /_template/demoTemplate*
		 * 所有模板 /_template
		 *
		 */
		String template = clientUtil.executeHttp("/_template/demotemplate_1",ClientUtil.HTTP_GET);
		System.out.println("HTTP_GET-------------------------");
		System.out.println(template);

	}
 
Example 6
Source File: ESTest.java    From bboss-elasticsearch with Apache License 2.0 6 votes vote down vote up
@Test
public void testCreateTempate() throws ParseException{

	ClientInterface clientUtil = ElasticSearchHelper.getConfigRestClientUtil("estrace/ESTemplate.xml");
	//创建模板
	String response = clientUtil.createTempate("demotemplate_1",//模板名称
			"demoTemplate");//模板对应的脚本名称,在estrace/ESTemplate.xml中配置
	System.out.println("createTempate-------------------------");
	System.out.println(response);
	//获取模板
	/**
	 * 指定模板
	 * /_template/demoTemplate_1
	 * /_template/demoTemplate*
	 * 所有模板 /_template
	 *
	 */
	String template = clientUtil.executeHttp("/_template/demotemplate_1",ClientUtil.HTTP_GET);
	System.out.println("HTTP_GET-------------------------");
	System.out.println(template);

}
 
Example 7
Source File: ESTest.java    From elasticsearch-gradle-example with Apache License 2.0 5 votes vote down vote up
public void testTempate() throws ParseException{

		ClientInterface clientUtil = ElasticSearchHelper.getConfigRestClientUtil("esmapper/estrace/ESTemplate.xml");
		//创建模板
		String response = clientUtil.createTempate("demotemplate_1",//模板名称
				"demoTemplate");//模板对应的脚本名称,在esmapper/estrace/ESTemplate.xml中配置
		System.out.println("createTempate-------------------------");
		System.out.println(response);
		//获取模板
		/**
		 * 指定模板
		 * /_template/demoTemplate_1
		 * /_template/demoTemplate*
		 * 所有模板 /_template
		 *
		 */
		String template = clientUtil.executeHttp("/_template/demotemplate_1",ClientUtil.HTTP_GET);
		System.out.println("HTTP_GET-------------------------");
		System.out.println(template);
		//删除模板
		template = clientUtil.executeHttp("/_template/demotemplate_1",ClientUtil.HTTP_DELETE);
		System.out.println("HTTP_DELETE-------------------------");
		System.out.println(template);

		template = clientUtil.executeHttp("/_template/demotemplate_1",ClientUtil.HTTP_GET);
		System.out.println("HTTP_GET after delete-------------------------");
		System.out.println(template);
	}
 
Example 8
Source File: ParentChildTest.java    From elasticsearch-gradle-example with Apache License 2.0 5 votes vote down vote up
/**
 * 通过读取配置文件中的dsl json数据导入雇员和公司数据
 */
public void importFromJsonData(){
	ClientInterface clientUtil = ElasticSearchHelper.getConfigRestClientUtil("esmapper/indexparentchild.xml");

	//导入公司数据,并且实时刷新,测试需要,实际环境不要带refresh
	clientUtil.executeHttp("company/company/_bulk?refresh","bulkImportCompanyData",ClientUtil.HTTP_POST);
	//导入雇员数据,并且实时刷新,测试需要,实际环境不要带refresh
	clientUtil.executeHttp("company/employee/_bulk?refresh","bulkImportEmployeeData",ClientUtil.HTTP_POST);
	long companycount = clientUtil.countAll("company/company");
	System.out.println(companycount);
	long employeecount = clientUtil.countAll("company/employee");
	System.out.println(employeecount);
}
 
Example 9
Source File: License.java    From elasticsearch-gradle-example with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args){
		ClientInterface eventClientUtil = ElasticSearchHelper.getConfigRestClientUtil("conf/license.xml");
		String ttt = eventClientUtil.executeHttp("_xpack/license?acknowledge=true","license", ClientUtil.HTTP_PUT);
//		System.out.println(ttt);
		logger.info(ttt);
		System.exit(1);
	}
 
Example 10
Source File: ESTest.java    From bboss-elasticsearch with Apache License 2.0 5 votes vote down vote up
@Test
public void testTempate() throws ParseException{

	ClientInterface clientUtil = ElasticSearchHelper.getConfigRestClientUtil("estrace/ESTemplate.xml");
	//创建模板
	String response = clientUtil.createTempate("demotemplate_1",//模板名称
			"demoTemplate");//模板对应的脚本名称,在estrace/ESTemplate.xml中配置
	System.out.println("createTempate-------------------------");
	System.out.println(response);
	//获取模板
	/**
	 * 指定模板
	 * /_template/demoTemplate_1
	 * /_template/demoTemplate*
	 * 所有模板 /_template
	 *
	 */
	String template = clientUtil.executeHttp("/_template/demotemplate_1",ClientUtil.HTTP_GET);
	System.out.println("HTTP_GET-------------------------");
	System.out.println(template);
	//删除模板
	template = clientUtil.executeHttp("/_template/demotemplate_1",ClientUtil.HTTP_DELETE);
	System.out.println("HTTP_DELETE-------------------------");
	System.out.println(template);

	template = clientUtil.executeHttp("/_template/demotemplate_1",ClientUtil.HTTP_GET);
	System.out.println("HTTP_GET after delete-------------------------");
	System.out.println(template);
}
 
Example 11
Source File: PhraseSuggestionTest.java    From elasticsearch-gradle-example with Apache License 2.0 5 votes vote down vote up
@Test
public void testPhraseSuggest(){
	ClientInterface clientUtil = ElasticSearchHelper.getConfigRestClientUtil("esmapper/estrace/suggest.xml");
	String template = clientUtil.getIndexMapping("test");
	System.out.println(template);

	String response = clientUtil.executeHttp("test/_search?pretty","phraseSearch", ClientUtil.HTTP_POST);
	System.out.println(response);

	PhraseRestResponse book = clientUtil.phraseSuggest("test/_search", "phraseSearch") ;
	Map<String, List<PhraseSuggest>> phraseSuggests = book.getSuggests();
	System.out.println();
}
 
Example 12
Source File: TraceESDaoTest.java    From elasticsearch-gradle-example with Apache License 2.0 5 votes vote down vote up
@Test
public void clusterMapState(){
	ClientInterface clientUtil = ElasticSearchHelper.getRestClientUtil();
	//返回map类型集群状态信息
	Map<String,Object> state = clientUtil.executeHttp("_cluster/state",ClientInterface.HTTP_GET,new ESMapResponseHandler());
	clientUtil.executeHttp("_cluster/state",ClientInterface.HTTP_GET,new ESMapResponseHandler());
	System.out.println(state);

}
 
Example 13
Source File: TraceESDaoTest.java    From elasticsearch-gradle-example with Apache License 2.0 5 votes vote down vote up
@Test
public void clusterHeathCheck(){
	ClientInterface clientUtil = ElasticSearchHelper.getRestClientUtil();
	//返回json格式健康状态
	String heath = clientUtil.executeHttp("_cluster/health?pretty",ClientInterface.HTTP_GET);
	System.out.println(heath);

}
 
Example 14
Source File: TestBulk.java    From elasticsearch-gradle-example with Apache License 2.0 5 votes vote down vote up
@Test
public void testBulkUpdate(){
	ClientInterface clientUtil = ElasticSearchHelper.getConfigRestClientUtil("esmapper/bulk.xml");
	List<OnlineGoodsInfoUpdateParams> onlineGoodsInfoUpdateParamss = new ArrayList<>();
	OnlineGoodsInfoUpdateParams onlineGoodsInfoUpdateParams = new OnlineGoodsInfoUpdateParams();
	onlineGoodsInfoUpdateParams.setId("aa");
	onlineGoodsInfoUpdateParams.setType("tt");
	onlineGoodsInfoUpdateParams.setIndex("ddd");
	onlineGoodsInfoUpdateParams.setVersion(1);
	onlineGoodsInfoUpdateParams.setVersionType("aaa");
	onlineGoodsInfoUpdateParams.setGoodsName("dddd");
	onlineGoodsInfoUpdateParamss.add(onlineGoodsInfoUpdateParams);

	onlineGoodsInfoUpdateParams = new OnlineGoodsInfoUpdateParams();
	onlineGoodsInfoUpdateParams.setId("aa");
	onlineGoodsInfoUpdateParams.setType("tt");
	onlineGoodsInfoUpdateParams.setIndex("ddd");
	onlineGoodsInfoUpdateParams.setVersion(1);
	onlineGoodsInfoUpdateParams.setVersionType("aaa");
	onlineGoodsInfoUpdateParams.setGoodsName("dddd");
	onlineGoodsInfoUpdateParamss.add(onlineGoodsInfoUpdateParams);
	Map<String,Object> params = new HashMap<>();
	params.put("onlineGoodsInfoUpdateParamss",onlineGoodsInfoUpdateParamss);
	String response = clientUtil.executeHttp("_bulk", "updateOnlineGoodsesInfo", params, ClientUtil.HTTP_POST);
	System.out.println(response);

}
 
Example 15
Source File: TraceESDaoTest.java    From elasticsearch-gradle-example with Apache License 2.0 5 votes vote down vote up
@Test
public void clusterState(){
	ClientInterface clientUtil = ElasticSearchHelper.getRestClientUtil();
	//返回json格式集群状态
	String state = clientUtil.executeHttp("_cluster/state?pretty",ClientInterface.HTTP_GET);
	System.out.println(state);

}
 
Example 16
Source File: ESTest.java    From elasticsearch-gradle-example with Apache License 2.0 4 votes vote down vote up
public void healthCheck(){
	ClientInterface rest = ElasticSearchHelper.getRestClientUtil("elasticSearch");
	String  status = rest.executeHttp("/",null,ClientUtil.HTTP_GET);
	System.out.println(status);
}
 
Example 17
Source File: TestScrollQuery.java    From elasticsearch-gradle-example with Apache License 2.0 4 votes vote down vote up
@Test
	public void testScroll(){
		ClientInterface clientUtil = ElasticSearchHelper.getConfigRestClientUtil("esmapper/scroll.xml");
		//scroll分页检索
		List<String > scrollIds = new ArrayList<>();
		long starttime = System.currentTimeMillis();
		Map params = new HashMap();

		params.put("size", 100);//每页100条记录
		ESDatas<Map> response = clientUtil.searchList("agentstat-*/_search?scroll=1m","scrollQuery",params,Map.class);
		List<Map> datas = response.getDatas();
		long realTotalSize = datas.size();
		long totalSize = response.getTotalSize();
		String scrollId = response.getScrollId();
		if(scrollId != null)
			scrollIds.add(scrollId);
		System.out.println("totalSize:"+totalSize);
		System.out.println("scrollId:"+scrollId);
		if(datas != null && datas.size() > 0) {//每页1000条记录,迭代scrollid,遍历scroll分页结果
			do {

				response = clientUtil.searchScroll("1m",scrollId,Map.class);
				scrollId = response.getScrollId();
				totalSize = response.getTotalSize();
				System.out.println("scroll totalSize:"+totalSize);
				if(scrollId != null)
					scrollIds.add(scrollId);
				datas = response.getDatas();

				if(datas == null || datas.size() == 0){
					break;
				}
				realTotalSize = realTotalSize + datas.size();
			} while (true);
		}
		long endtime = System.currentTimeMillis();
		System.out.println("耗时:"+(endtime - starttime)+",realTotalSize:"+realTotalSize+",totalSize:"+totalSize);
		//查询存在es服务器上的scroll上下文信息
		String scrolls = clientUtil.executeHttp("_nodes/stats/indices/search", ClientUtil.HTTP_GET);
//		System.out.println(scrolls);
		//处理完毕后清除scroll上下文信息
		if(scrollIds.size() > 0) {
			scrolls = clientUtil.deleteScrolls(scrollIds);
//			System.out.println(scrolls);
		}
		//清理完毕后查看scroll上下文信息
		scrolls = clientUtil.executeHttp("_nodes/stats/indices/search", ClientUtil.HTTP_GET);
//		System.out.println(scrolls);
	}
 
Example 18
Source File: TestScrollQuery.java    From elasticsearch-gradle-example with Apache License 2.0 4 votes vote down vote up
/**
	 * 并行方式执行slice scroll操作
	 */
	@Test
	public void testParralSliceScroll() {
		final ClientInterface clientUtil = ElasticSearchHelper.getConfigRestClientUtil("esmapper/scroll.xml");
		final List<String> scrollIds = new ArrayList<>();
		long starttime = System.currentTimeMillis();
		//scroll slice分页检索
		final int max = 6;
		final CountDownLatch countDownLatch = new CountDownLatch(max);//线程任务完成计数器,每个线程对应一个sclice,每运行完一个slice任务,countDownLatch计数减去1

		for (int j = 0; j < max; j++) {
			final int i = j;
			Thread sliceThread = new Thread(new Runnable() {//多线程并行执行scroll操作做,每个线程对应一个sclice

				@Override
				public void run() {
					Map params = new HashMap();
					params.put("id", i);
					params.put("max", max);//最多6个slice,不能大于share数
					params.put("size", 100);//每页100条记录
					ESDatas<Map> sliceResponse = clientUtil.searchList("agentstat-*/_search?scroll=1m",
							"scrollSliceQuery", params,Map.class);
					List<Map> sliceDatas = sliceResponse.getDatas();
					incrementSize( sliceDatas.size());//统计实际处理的文档数量
					long totalSize = sliceResponse.getTotalSize();
					String scrollId = sliceResponse.getScrollId();
					if (scrollId != null)
						scrollIds.add(scrollId);
					System.out.println("totalSize:" + totalSize);
					System.out.println("scrollId:" + scrollId);
					if (sliceDatas != null && sliceDatas.size() >= 100) {//每页100条记录,迭代scrollid,遍历scroll分页结果
						do {
							sliceResponse = clientUtil.searchScroll("1m", scrollId, Map.class);
							String sliceScrollId = sliceResponse.getScrollId();
							if (sliceScrollId != null)
								scrollIds.add(sliceScrollId);
							sliceDatas = sliceResponse.getDatas();
							if (sliceDatas == null || sliceDatas.size() < 100) {
								break;
							}
							incrementSize( sliceDatas.size());//统计实际处理的文档数量
						} while (true);
					}
					countDownLatch.countDown();//slice检索完毕后计数器减1
				}

			});
			sliceThread.start();
		}
		try {
			countDownLatch.await();//等待所有的线程执行完毕,计数器变成0
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		long endtime = System.currentTimeMillis();
		System.out.println("耗时:"+(endtime - starttime)+",realTotalSize:"+realTotalSize);
		//查询存在es服务器上的scroll上下文信息
		String scrolls = clientUtil.executeHttp("_nodes/stats/indices/search", ClientUtil.HTTP_GET);
//		System.out.println(scrolls);
		//处理完毕后清除scroll上下文信息
		if(scrollIds.size() > 0) {
			scrolls = clientUtil.deleteScrolls(scrollIds);
//			System.out.println(scrolls);
		}
		//清理完毕后查看scroll上下文信息
		scrolls = clientUtil.executeHttp("_nodes/stats/indices/search", ClientUtil.HTTP_GET);
//		System.out.println(scrolls);
	}
 
Example 19
Source File: TestScrollQuery.java    From elasticsearch-gradle-example with Apache License 2.0 4 votes vote down vote up
/**
 * 串行方式执行slice scroll操作
 */
@Test
public void testSliceScroll() {
	ClientInterface clientUtil = ElasticSearchHelper.getConfigRestClientUtil("esmapper/scroll.xml");
	List<String> scrollIds = new ArrayList<>();
	long starttime = System.currentTimeMillis();
	//scroll slice分页检索
	int max = 6;
	long realTotalSize = 0;
	for (int i = 0; i < max; i++) {
		Map params = new HashMap();
		params.put("id", i);
		params.put("max", max);//最多6个slice,不能大于share数
		params.put("size", 100);//每页100条记录
		ESDatas<Map> sliceResponse = clientUtil.searchList("agentstat-*/_search?scroll=1m",
				"scrollSliceQuery", params,Map.class);
		List<Map> sliceDatas = sliceResponse.getDatas();
		realTotalSize = realTotalSize + sliceDatas.size();
		long totalSize = sliceResponse.getTotalSize();
		String scrollId = sliceResponse.getScrollId();
		if (scrollId != null)
			scrollIds.add(scrollId);
		System.out.println("totalSize:" + totalSize);
		System.out.println("scrollId:" + scrollId);
		if (sliceDatas != null && sliceDatas.size() >= 100) {//每页100条记录,迭代scrollid,遍历scroll分页结果
			do {
				sliceResponse = clientUtil.searchScroll("1m", scrollId, Map.class);
				String sliceScrollId = sliceResponse.getScrollId();
				if (sliceScrollId != null)
					scrollIds.add(sliceScrollId);
				sliceDatas = sliceResponse.getDatas();
				if (sliceDatas == null || sliceDatas.size() < 100) {
					break;
				}
				realTotalSize = realTotalSize + sliceDatas.size();
			} while (true);
		}
	}
	long endtime = System.currentTimeMillis();
	System.out.println("耗时:"+(endtime - starttime)+",realTotalSize:"+realTotalSize);
	//查询存在es服务器上的scroll上下文信息
	String scrolls = clientUtil.executeHttp("_nodes/stats/indices/search", ClientUtil.HTTP_GET);
	System.out.println(scrolls);
	//处理完毕后清除scroll上下文信息
	if(scrollIds.size() > 0) {
		scrolls = clientUtil.deleteScrolls(scrollIds);
		System.out.println(scrolls);
	}
	//清理完毕后查看scroll上下文信息
	scrolls = clientUtil.executeHttp("_nodes/stats/indices/search", ClientUtil.HTTP_GET);
	System.out.println(scrolls);
}
 
Example 20
Source File: TestScrollQuery.java    From elasticsearch-gradle-example with Apache License 2.0 4 votes vote down vote up
/**
	 * 并行方式执行slice scroll操作
	 */
	@Test
	public void testParralSliceScroll() {
		final ClientInterface clientUtil = ElasticSearchHelper.getConfigRestClientUtil("esmapper/scroll.xml");
		final List<String> scrollIds = new ArrayList<>();
		long starttime = System.currentTimeMillis();
		//scroll slice分页检索
		final int max = 6;
		final CountDownLatch countDownLatch = new CountDownLatch(max);//线程任务完成计数器,每个线程对应一个sclice,每运行完一个slice任务,countDownLatch计数减去1

		for (int j = 0; j < max; j++) {
			final int i = j;
			Thread sliceThread = new Thread(new Runnable() {//多线程并行执行scroll操作做,每个线程对应一个sclice

				@Override
				public void run() {
					Map params = new HashMap();
					params.put("id", i);
					params.put("max", max);//最多6个slice,不能大于share数
					params.put("size", 100);//每页100条记录
					ESDatas<Map> sliceResponse = clientUtil.searchList("agentstat-*/_search?scroll=1m",
							"scrollSliceQuery", params,Map.class);
					List<Map> sliceDatas = sliceResponse.getDatas();
					incrementSize( sliceDatas.size());//统计实际处理的文档数量
					long totalSize = sliceResponse.getTotalSize();
					String scrollId = sliceResponse.getScrollId();
					if (scrollId != null)
						scrollIds.add(scrollId);
					System.out.println("totalSize:" + totalSize);
					System.out.println("scrollId:" + scrollId);
					if (sliceDatas != null && sliceDatas.size() >= 100) {//每页100条记录,迭代scrollid,遍历scroll分页结果
						do {
							sliceResponse = clientUtil.searchScroll("1m", scrollId, Map.class);
							String sliceScrollId = sliceResponse.getScrollId();
							if (sliceScrollId != null)
								scrollIds.add(sliceScrollId);
							sliceDatas = sliceResponse.getDatas();
							if (sliceDatas == null || sliceDatas.size() < 100) {
								break;
							}
							incrementSize( sliceDatas.size());//统计实际处理的文档数量
						} while (true);
					}
					countDownLatch.countDown();//slice检索完毕后计数器减1
				}

			});
			sliceThread.start();
		}
		try {
			countDownLatch.await();//等待所有的线程执行完毕,计数器变成0
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		long endtime = System.currentTimeMillis();
		System.out.println("耗时:"+(endtime - starttime)+",realTotalSize:"+realTotalSize);
		//查询存在es服务器上的scroll上下文信息
		String scrolls = clientUtil.executeHttp("_nodes/stats/indices/search", ClientUtil.HTTP_GET);
//		System.out.println(scrolls);
		//处理完毕后清除scroll上下文信息
		if(scrollIds.size() > 0) {
			scrolls = clientUtil.deleteScrolls(scrollIds);
//			System.out.println(scrolls);
		}
		//清理完毕后查看scroll上下文信息
		scrolls = clientUtil.executeHttp("_nodes/stats/indices/search", ClientUtil.HTTP_GET);
//		System.out.println(scrolls);
	}