史上最快! 10小时大数据入门实战(六)- Hadoop 项目实战
1 用户行为日志概述 离线数据处理架构 3 项目需求 4 UserAgent 类实现 使用工具框架 5
@Test
public void testQuery(){
ClientInterface clientUtil = ElasticSearchHelper.getRestClientUtil();
String json = clientUtil.executeHttp("/_xpack/sql?format=txt",
"{\"query\": \"SELECT * FROM dbclobdemo\"}",
ClientInterface.HTTP_POST
);
System.out.println(json);
json = clientUtil.executeHttp("/_xpack/sql?format=json",
"{\"query\": \"SELECT * FROM dbclobdemo\"}",
ClientInterface.HTTP_POST
);
System.out.println(json);
}
public void testTranslate(){
ClientInterface clientUtil = ElasticSearchHelper.getRestClientUtil();
String json = clientUtil.executeHttp("/_xpack/sql/translate",
"{\"query\": \"SELECT * FROM dbclobdemo\"}",
ClientInterface.HTTP_POST
);
System.out.println(json);
}
{
"size": 1000,
"_source": {
"includes": [
"author",
"content",
"docClass",
"docabstract",
"keywords",
"mediapath",
"newpicPath",
"parentDetailTpl",
"picPath",
"publishfilename",
"secondtitle",
"subtitle",
"title",
"titlecolor"
],
"excludes": []
},
"docvalue_fields": [
"auditflag",
"channelId",
"count",
"createtime",
"createuser",
"detailtemplateId",
"docLevel",
"docsourceId",
"doctype",
"documentId",
"docwtime",
"flowId",
"isdeleted",
"isnew",
"ordertime",
"publishtime",
"seq",
"status",
"version"
],
"sort": [
{
"_doc": {
"order": "asc"
}
}
]
}
<properties>
<!--
sql query
-->
<property name="sqlQuery">
<![CDATA[
{"query": "SELECT * FROM dbclobdemo where channelId=#[channelId]"}
]]>
</property>
</properties>
public void testSQLQueryFromDSL(){
ClientInterface clientUtil = ElasticSearchHelper.getConfigRestClientUtil("esmapper/sql.xml");//初始化一个加载sql配置文件的es客户端接口
//设置sql查询的参数
Map params = new HashMap();
params.put("channelId",1);
String json = clientUtil.executeHttp("/_xpack/sql","sqlQuery",params,
ClientInterface.HTTP_POST
);
System.out.println(json);//打印检索结果
}
{
"columns": [
{
"name": "auditflag",
"type": "long"
},
{
"name": "author",
"type": "text"
},
{
"name": "channelId",
"type": "long"
},
{
"name": "content",
"type": "text"
},
{
"name": "count",
"type": "long"
},
{
"name": "createtime",
"type": "date"
},
{
"name": "createuser",
"type": "long"
},
{
"name": "detailtemplateId",
"type": "long"
},
{
"name": "docClass",
"type": "text"
},
{
"name": "docLevel",
"type": "long"
},
{
"name": "docabstract",
"type": "text"
},
{
"name": "docsourceId",
"type": "long"
},
{
"name": "doctype",
"type": "long"
},
{
"name": "documentId",
"type": "long"
},
{
"name": "docwtime",
"type": "date"
},
{
"name": "flowId",
"type": "long"
},
{
"name": "isdeleted",
"type": "long"
},
{
"name": "isnew",
"type": "long"
},
{
"name": "keywords",
"type": "text"
},
{
"name": "mediapath",
"type": "text"
},
{
"name": "newpicPath",
"type": "text"
},
{
"name": "ordertime",
"type": "date"
},
{
"name": "parentDetailTpl",
"type": "text"
},
{
"name": "picPath",
"type": "text"
},
{
"name": "publishfilename",
"type": "text"
},
{
"name": "publishtime",
"type": "date"
},
{
"name": "secondtitle",
"type": "text"
},
{
"name": "seq",
"type": "long"
},
{
"name": "status",
"type": "long"
},
{
"name": "subtitle",
"type": "text"
},
{
"name": "title",
"type": "text"
},
{
"name": "titlecolor",
"type": "text"
},
{
"name": "version",
"type": "long"
}
],
"rows": [
[
0,
"不详",
1,
"asdfasdfasdfasdfsdf<img name=\"imgs\" src=\"../gencode7.png\" _ewebeditor_pa_src=\"http%3A%2F%2Flocalhost%2Fcms%2FsiteResource%2Ftest%2F_webprj%2Fgencode7.png\"><br>\r\nasdfasdf<img name=\"imgs\" src=\"content_files/20180505101457109.png\" _ewebeditor_pa_src=\"http%3A%2F%2Flocalhost%2Fcms%2FsiteResource%2Ftest%2F_webprj%2Fnews%2Fcontent_files%2F20180505101457109.png\"><br>\r\n<br>",
0,
"2018-04-12T14:16:02.000Z",
1,
1,
"普通分类",
1,
"无asdfasdf",
1,
0,
1,
"2018-05-06T03:30:04.000Z",
2,
0,
0,
"news",
"uploadfiles/201803/gencode4.png",
"",
"2018-04-12T14:06:45.000Z",
"1",
"uploadfiles/201803/gencode1.png",
"asdf.html",
"2018-04-14T14:36:12.000Z",
"",
0,
11,
"asdf",
"adsf",
"#000000",
1
]
]
}
微信关注我们
转载内容版权归作者及来源网站所有!
低调大师中文资讯倾力打造互联网数据资讯、行业资源、电子商务、移动互联网、网络营销平台。持续更新报道IT业界、互联网、市场资讯、驱动更新,是最及时权威的产业资讯及硬件资讯报道平台。
马里奥是站在游戏界顶峰的超人气多面角色。马里奥靠吃蘑菇成长,特征是大鼻子、头戴帽子、身穿背带裤,还留着胡子。与他的双胞胎兄弟路易基一起,长年担任任天堂的招牌角色。
为解决软件依赖安装时官方源访问速度慢的问题,腾讯云为一些软件搭建了缓存服务。您可以通过使用腾讯云软件源站来提升依赖包的安装速度。为了方便用户自由搭建服务架构,目前腾讯云软件源站支持公网访问和内网访问。
Spring框架(Spring Framework)是由Rod Johnson于2002年提出的开源Java企业级应用框架,旨在通过使用JavaBean替代传统EJB实现方式降低企业级编程开发的复杂性。该框架基于简单性、可测试性和松耦合性设计理念,提供核心容器、应用上下文、数据访问集成等模块,支持整合Hibernate、Struts等第三方框架,其适用范围不仅限于服务器端开发,绝大多数Java应用均可从中受益。
Rocky Linux(中文名:洛基)是由Gregory Kurtzer于2020年12月发起的企业级Linux发行版,作为CentOS稳定版停止维护后与RHEL(Red Hat Enterprise Linux)完全兼容的开源替代方案,由社区拥有并管理,支持x86_64、aarch64等架构。其通过重新编译RHEL源代码提供长期稳定性,采用模块化包装和SELinux安全架构,默认包含GNOME桌面环境及XFS文件系统,支持十年生命周期更新。