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

The following examples show how to use org.frameworkset.elasticsearch.client.ClientInterface#createTempate() . 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 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 2
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 3
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 4
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);
	}