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

The following examples show how to use org.frameworkset.elasticsearch.client.ClientInterface#addDateDocuments() . 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: ESTest.java    From elasticsearch-gradle-example with Apache License 2.0 5 votes vote down vote up
public void testBulkAddDateDocument() throws ParseException{
	testGetmapping();
	SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd");
	String date = format.format(new Date());
	ClientInterface clientUtil = ElasticSearchHelper.getConfigRestClientUtil("esmapper/estrace/ESTracesMapper.xml");
	List<Demo> demos = new ArrayList<>();
	Demo demo = new Demo();
	demo.setDemoId(2l);
	demo.setAgentStarttime(new Date());
	demo.setApplicationName("blackcatdemo2");
	demo.setContentbody("this is content body2");
	demos.add(demo);

	demo = new Demo();
	demo.setDemoId(3l);
	demo.setAgentStarttime(new Date());
	demo.setApplicationName("blackcatdemo3");
	demo.setContentbody("this is content body3");
	demos.add(demo);

	//创建模板
	String response = clientUtil.addDateDocuments("demo",//索引表
			"demo",//索引类型
			"createDemoDocument",//创建文档对应的脚本名称,在esmapper/estrace/ESTracesMapper.xml中配置
			demos);

	System.out.println("addDateDocument-------------------------");
	System.out.println(response);

	response = clientUtil.getDocument("demo-"+date,//索引表
			"demo",//索引类型
			"2");
	System.out.println("getDocument-------------------------");
	System.out.println(response);

	demo = clientUtil.getDocument("demo-"+date,//索引表
			"demo",//索引类型
			"3",//创建文档对应的脚本名称,在esmapper/estrace/ESTracesMapper.xml中配置
			Demo.class);
}
 
Example 2
Source File: ESTest.java    From elasticsearch-gradle-example with Apache License 2.0 5 votes vote down vote up
public void testBulkAddDocument() throws ParseException{
	testGetmapping();
	SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd");
	String date = format.format(new Date());
	ClientInterface clientUtil = ElasticSearchHelper.getConfigRestClientUtil("esmapper/estrace/ESTracesMapper.xml");
	List<Demo> demos = new ArrayList<>();
	Demo demo = new Demo();
	demo.setDemoId(2l);
	demo.setAgentStarttime(new Date());
	demo.setApplicationName("blackcatdemo2");
	demo.setContentbody("this is content body2");
	demos.add(demo);

	demo = new Demo();
	demo.setDemoId(3l);
	demo.setAgentStarttime(new Date());
	demo.setApplicationName("blackcatdemo3");
	demo.setContentbody("this is content body3");
	demos.add(demo);

	//创建模板
	String response = clientUtil.addDateDocuments("demo",//索引表
			"demo",//索引类型
			"createDemoDocument",//创建文档对应的脚本名称,在esmapper/estrace/ESTracesMapper.xml中配置
			demos);

	System.out.println("addDateDocument-------------------------");
	System.out.println(response);

	response = clientUtil.getDocument("demo-"+date,//索引表
			"demo",//索引类型
			"2");
	System.out.println("getDocument-------------------------");
	System.out.println(response);

	demo = clientUtil.getDocument("demo-"+date,//索引表
			"demo",//索引类型
			"3",//创建文档对应的脚本名称,在esmapper/estrace/ESTracesMapper.xml中配置
			Demo.class);
}
 
Example 3
Source File: ESTest.java    From bboss-elasticsearch with Apache License 2.0 4 votes vote down vote up
@Test
public void testBulkAddDateDocument() throws ParseException{
	testGetmapping();
	SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd");
	String date = format.format(new Date());
	ClientInterface clientUtil = ElasticSearchHelper.getConfigRestClientUtil("estrace/ESTracesMapper.xml");
	List<Demo> demos = new ArrayList<Demo>();
	Demo demo = new Demo();
	demo.setDemoId(2l);
	demo.setAgentStarttime(new Date());
	demo.setApplicationName("blackcatdemo2");
	demo.setContentbody("this is content body2");
	demos.add(demo);

	demo = new Demo();
	demo.setDemoId(3l);
	demo.setAgentStarttime(new Date());
	demo.setApplicationName("blackcatdemo3");
	demo.setContentbody("this is content body3");
	demos.add(demo);

	//创建模板
	String response = clientUtil.addDateDocuments("demo",//索引表
			"demo",//索引类型
			"createDemoDocument",//创建文档对应的脚本名称,在estrace/ESTracesMapper.xml中配置
			demos);

	System.out.println("addDateDocument-------------------------");
	System.out.println(response);

	response = clientUtil.getDocument("demo-"+date,//索引表
			"demo",//索引类型
			"2");
	System.out.println("getDocument-------------------------");
	System.out.println(response);

	demo = clientUtil.getDocument("demo-"+date,//索引表
			"demo",//索引类型
			"3",//创建文档对应的脚本名称,在estrace/ESTracesMapper.xml中配置
			Demo.class);
}
 
Example 4
Source File: PingyinTest.java    From elasticsearch-gradle-example with Apache License 2.0 4 votes vote down vote up
@Test
	public void testBulkAddDateDocument1() throws ParseException {
//		testCreateDemoMapping();
		SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd");
		String date = format.format(new Date());
		ClientInterface clientUtil = ElasticSearchHelper.getRestClientUtil();
		List<Demo> demos = new ArrayList<>();
		Demo demo = new Demo();
		demo.setDemoId(12l);
		demo.setAgentStarttime(new Date());
		demo.setApplicationName("blackcatdemo2");
		demo.setContentbody("this is content body2");
		demo.setName("liu德华");
		demos.add(demo);

		demo = new Demo();
		demo.setDemoId(13l);
		demo.setAgentStarttime(new Date());
		demo.setApplicationName("blackcatdemo3");
		demo.setContentbody("四大天王,这种文化很好,中华人民共和国");
		demo.setName("zhang学友");
		demos.add(demo);

		//创建模板
		String response = clientUtil.addDateDocuments("demo",//索引表
				"demo",//索引类型
				demos);

		System.out.println("addDateDocument-------------------------");
		System.out.println(response);

		response = clientUtil.getDocument("demo-"+date,//索引表
				"demo",//索引类型
				"12");
		System.out.println("getDocument-------------------------");
		System.out.println(response);

		demo = clientUtil.getDocument("demo-"+date,//索引表
				"demo",//索引类型
				"13",//创建文档对应的脚本名称,在esmapper/estrace/ESTracesMapper.xml中配置
				Demo.class);
	}
 
Example 5
Source File: PingyinTest.java    From elasticsearch-gradle-example with Apache License 2.0 4 votes vote down vote up
@Test
	public void testBulkAddDocument1() throws ParseException {
//		testCreateDemoMapping();
		SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd");
		String date = format.format(new Date());
		ClientInterface clientUtil = ElasticSearchHelper.getRestClientUtil();
		List<Demo> demos = new ArrayList<>();
		Demo demo = new Demo();
		demo.setDemoId(12l);
		demo.setAgentStarttime(new Date());
		demo.setApplicationName("blackcatdemo2");
		demo.setContentbody("this is content body2");
		demo.setName("liu德华");
		demos.add(demo);

		demo = new Demo();
		demo.setDemoId(13l);
		demo.setAgentStarttime(new Date());
		demo.setApplicationName("blackcatdemo3");
		demo.setContentbody("四大天王,这种文化很好,中华人民共和国");
		demo.setName("zhang学友");
		demos.add(demo);

		//创建模板
		String response = clientUtil.addDateDocuments("demo",//索引表
				"demo",//索引类型
				demos);

		System.out.println("addDateDocument-------------------------");
		System.out.println(response);

		response = clientUtil.getDocument("demo-"+date,//索引表
				"demo",//索引类型
				"12");
		System.out.println("getDocument-------------------------");
		System.out.println(response);

		demo = clientUtil.getDocument("demo-"+date,//索引表
				"demo",//索引类型
				"13",//创建文档对应的脚本名称,在esmapper/estrace/ESTracesMapper.xml中配置
				Demo.class);
	}