获取在配置文件中根据DSL名称定义的DSL并执行它
ClientInterface clientUtil = ElasticSearchHelper.getConfigRestClientUtil("esmapper/sql.xml");//define an instanceof ConfigRestClientUtil,It's single instance, multithreaded secure.
Map params = new HashMap();
params.put("channelId",1);
List<Map> json = clientUtil.sql(Map.class,"sqlQuery",params);
sql.xml:
<properties>
<property name="sqlQuery">
property>
properties>
2.getRestClientUtil例子
直接执行代码中定义的DSL。
ClientInterface clientUtil = ElasticSearchHelper.getRestClientUtil();//define an instanceof RestClientUtil,It's single instance, multithreaded secure.
List<Map> json = clientUtil.sql(Map.class,"{\"query\\": \\"SELECT * FROM demo\\"}");
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)